Recursive Functions

In pure lambda calculus, there are no named functions. This is a problem for recursion, since in means that functions are not able to reference themselves. Luckily, there are fixed point combinators (in our case, Z) which can achieve a recursive effect.

Lambda Calculus representation

defr f(n) {...} = Z (@self.@n.{...})

Usage

To define a recursive function, you must use the defr keyword. Additionally, instead of referencing the name of the function for the recursive call, use the self keyword.

Example

Guards work well for base cases!

See also