Comments
Loading Dream Comments...
You must be logged in to write a comment - Log In
Currying is the Comp-Sci term for building a function from another function which embeds some of its parameters, for example :
Foo1 <:: &{ whatever (%!1, %!2, woowoo); }
Here "Foo1" will be called with two parameters, but calls "whatever" with three parameters. A better example is :
Foo2 <:: &{(savedlambda=%!1, savedparam=%!2);
&{(embeddedlambda=savedlambda, embeddedparam=savedparam); embeddedlambda (embeddedparam << &%);}; }
Calling the function "Foo2" with four parameters, for example :
MyNewFunc <:: Foo2 (&myfunc, "hello");
MyNewFunc (123, 456);
which effectively calls myfunc ("hello", 123, 456);
results in a function which embeds and calls the function supplied as the first parameter, passing the second parameter implicitly.
E&OE (untested code) :)