3.11 Theory
The strict Y fixed-point combinator. Allows for recursion of anonymous
functions. Given a fn1 which contains a single named argument, and
within which is an additional single-argument fn2, the innermost
fn2 can call the named argument of fn1 as if it were a
function name in order to recur on itself. For example, the factorial function
can be defined thusly, using the Y-combinator:
Note however that usage of the Y-combinator for recursion is not especially
efficient, and the more traditional recursive approach is generally recommended
whenever possible (which is most of the time).
A generalization of the Y-combinator that allows the function to take any number
of arguments.
syntax
(fnlet name args body ...+)
Equivalent to (Y* (fn (name) (fn args body ...))).
For example, to map the Fibonacci sequence without
defining a named function to do it:
Example:
Returns a function with the args partially applied to fun,
which can then be passed the remaining arguments, as many as needed to complete
the calculation. For example:
Returns a new function which is a composition of fn1 and fn2.
This function evaluates fn2 with its arguments, and then applies
fn1 to the result of fn2.
Returns v.