Functional Programming in Scheme Expressions, Types, and Functions
Anonymous functions
A function object does not have a name, and
a function object is not necessarily bound to a name
1> ((lambda(x) (+ x 1)) 3)
4
2> (define fu-lst
(list (lambda (x) (+ x 1)) (lambda (x) (* x 5))))
3> fu-lst
(#<procedure> #<procedure>)
4> ((second fu-lst) 6)
30
An illustration of anonymous functions. The function (lambda(x) (+ x 1)) is the function that adds one (to its parameter).
It is organized in a list side by side with the function that multiplies by five. Notice in this context that none of these
two functions are named. In the last interaction we apply the latter to the number 6.