Chapter 1, Building Abstractions with Procedures

Section - Formulating Abstractions with Higher-Order Procedures

Exercise 1.34


We are given the following procedure:

1
2
3
(define (f g)
 (g 2)
)

When this prcedure is invoked by passing itself as argument, we get following error:

1
2
3
4
> ( f f)
. . application: not a procedure;
 expected a procedure that can be applied to arguments
  given: 2

We can understand this by substituting:

1
2
3
(f f)
(f 2)
(2 2)

As we can see in the last statement, interpreter expects a procedure after opening bracket but 2 is not a procedure.