Description Usage Arguments Details Value Note See Also Examples
curry
and related functions modify other functions by pre-setting
their arguments.
1 2 3 4 5 | curry(f, ...)
lazy.curry(f, ...)
uncurry(f)
|
f |
The function to curry or uncurry. |
... |
Arguments to be used in currying. |
Strictly speaking, these functions do partial application rather than
currying, but they can be used to implement proper currying if desired, and
the abuse of terminology is common. For an introduction to the whole concept
of function currying and why it's useful, in more detail than we can give
here, see the ever-helpful
Wikipedia.
curry
uses standard evaluation (i.e., does not implicitly quote its
arguments), while lazy.curry
uses substitute
to avoid
evaluating its arguments before using them in currying.
uncurry
takes a curried function - one resulting from a call to
curry
or lazy.curry
- and undoes the currying, returning the
original function without pre-set arguments.
If currying is nested, one call to uncurry
can be made for each call
to curry
or lazy.curry
- attempting to uncurry a function more
times than it's been curried will raise an error.
For curry
and lazy.curry
, the curried function;
for uncurry
, the uncurried function. Note that uncurry
will raise an error if its argument did not result from a call to
curry
or lazy.curry
.
Currying is named after the mathematician Haskell Curry.
compose
, which is frequently useful in conjunction with the
currying and uncurrying functions.
1 2 3 4 5 6 7 8 9 |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.