[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: accumulator generator (Scheme)

> I'm trying to build a collection of a simple SICP kind
> of problem expressed in a lot of different languages.
> Here, for reference, is the code in Scheme:
> (define (foo n)
>   (lambda (i) (set! n (+ n i))))

Shouldn't that be:

 (define (foo n)
   (lambda (i) (set! n (+ n i)) n))

(Forgive if someone has pointed this out already, I haven't quite caught up
with this thread yet.)