my attempt to do the exercises in sicp.

Monday, June 30, 2008

sicp exercise 1.34


;  Exercise 1.34. Suppose we define the procedure
;  (define (f g)
;  (g 2))
;  Then we have
;  (f square)
;  4
;  (f (lambda (z) (* z (+ z 1))))
;  6
;  What happens if we (perversely) ask the interpreter to evaluate the combination (f f)? Explain.


(define (f g) (g 2))

; evaluating (f f)
; (f f)
; (f 2)
; (2 2)
; error


No comments: