In Scheme, function arguments are passed by value,
so the outer x is not affected by the set!.  You could
use a macro:

(define-macro (inc x) `(set! ,x (+ ,x 1)))

or if you want boxes, r7rs has an implementation.

_______________________________________________
Cmdist mailing list
[email protected]
https://cm-mail.stanford.edu/mailman/listinfo/cmdist

Reply via email to