
Functon λ [EXPERIMENTAL]
Installation
python3 -m pip install functon
Usage
Hello world:
>>> from functon import fn
>>> fn(print, "Hello world!")
'Hello world!'
Triple the value of a number:
>>> from functon import defun, fn
>>> def triple(x: int) -> defun(("*", 3, "x")):
... """Compute three times X."""
>>> fn(triple, 3)
9
Compute factorials using recursion:
>>> from functon import defun, fn, IF
>>> def factorial(N: int) -> defun((IF, ("=", "N", 1), 1, ("*", "N", ("factorial", ("-", "N", 1))))):
... """Compute the factorial of N."""
>>> fn(factorial, 5)
120