
/* Defining a For function */
TemplateFunction("For",{start,predicate,increment,body})
[
  Eval(start);
  While (Equals(Eval(predicate),True))
  [
    Eval(body);
    Eval(increment);
  ];
];
UnFence("For",4);
HoldArgNr("For",4,1);
HoldArgNr("For",4,2);
HoldArgNr("For",4,3);
HoldArgNr("For",4,4);



TemplateFunction("ForEach",{item,list,body})
[
  Local(foreachtail);
  MacroLocal(item);
  Set(foreachtail,list);
  While(Not(Equals(foreachtail,{})))
  [
     MacroSet(item,Head(foreachtail));
     Eval(body);
     Set(foreachtail,Tail(foreachtail));
  ];
];
UnFence("ForEach",3);
HoldArgNr("ForEach",3,1);
HoldArgNr("ForEach",3,3);


Apply(_applyoper,_applyargs) <-- ApplyPure(applyoper,applyargs);
UnFence("Apply",2);


TemplateFunction("Until",{predicate,body})
[
  Eval(body);
  While (Equals(Eval(predicate),False))
  [
    Eval(body);
  ];
  True;
];
UnFence("Until",2);
HoldArgNr("Until",2,1);
HoldArgNr("Until",2,2);



