fn creates an anonymous function.
Syntax
(fn (⟨arg⟩ ...) ⟨body⟩)
Semantics
fnis the standard way to write lambdas in Coalton.- A closure is allocated when variables are captured.
fnalso supports keyword arguments with&key.returnmay be used to return a value from the function.
Example
(fn (x)
(+ x 2))