Wednesday, July 1, 2009

Ex-3.8

(define y 1)
(define (f x)
(set! y (* y x))
y)
;trying on MIT/GNU Scheme
1 ]=> (+ (f 0) (f 1))
;Value: 1

;so arguments are evaluated right to left

We need to set y back to 1 if we want to re-run.

No comments:

Post a Comment