A sample read-eval-print session with lambda expressions and function objects. In a context where we define
x to the number 6 we first evaluate a lambda expression.
Scheme acknowledges this by returning the function object, which prints like '
#<procedure> '. As
a contrast to numbers, lists, and other simple values, there is
no good surface representation of function values (function objects). Next we bind the name
inc
to the same function object. More about name binding in
a later part of this material. The expression
(if (even? x) inc fac)
returns
inc because the value of
x is 6, and as such it is even. Therefore the value of
((if (even? x) inc fac) 5)
is the same as the value of
(inc 5), namely 6.