Curried Functions



On 2/18/08, Peter Danenberg <pcd at wikitex.org> wrote:

>     curry(f, [args]) := lambda([[x]], apply(f, append([args], x)));

lambda does not evaluate its arguments (does not even simplify them).
One way to get what (I think) you want is to use buildq.

curry(f, [args]) := buildq ([f, args], lambda([[x]], apply (f, append
(args, x))));

dble : curry ("*", 2);
 => lambda([[x]],apply("*",append([2],x)))

dble (5);
 => 10

buildq is reminiscent of `(,x , at y) macrology -- I think it even says so
in the source code.

HTH

Robert Dodier