previous
|
index
|
next
Lambda Expressions
Since lambda expressions are procedures, we can use them anywhere procedures are expected
One such place is at the beginning of an application:
(- 25 16) (sqrt (- 25 16)) ((lambda (x) (* x x)) 12)
The last application's value is 144. Here's how Scheme evaluates it:
Notice that the first item in the application is the lambda expression
(lambda (x) (* x x))
Replace the parameter
x
everywhere in the body with the argument
12
to obtain
(* 12 12)
Evaluate the expression
(* 12 12)
to obtain the value 144
previous
|
index
|
next