[CM] About set!

bil at ccrma.Stanford.EDU bil at ccrma.Stanford.EDU
Sat Jun 27 14:40:44 PDT 2020

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.

More information about the Cmdist mailing list