SICP/ex-5_31-xx.scm

35 lines
794 B
Scheme

(load "util.scm")
(display "\nex-5.31\n")
; 1. save and restore env around operator
; 2. save and restore env around each operand (except last)
; 3. save and restore argl around each operand
; 4. save and restore proc around operand sequence
; (f 'x 'y)
; 1-4 are superfluous
; ((f) 'x 'y)
; 1-4 are superfluous
; no need to save env because compound-apply without args does
; not change env
; (f (g 'x) y)
; 1 is superfluous
; we need 2 because (g 'x) changes the env for y
; we need 3 because (g 'x) changes argl
; we need 4 because (g 'x) changes proc
; (f (g 'x) 'y) ; 1 is superfluous
; 1-2 are superfluous
; (g 'x) changes the env but we don't need it later (better save it anyway)
; 3-4 are still needed
(display "[answered]\n")
(display "\nex-5.32\n")
(display "\nex-5.33\n")