[CM] About set!
chris.actondev at gmail.com
Sat Jun 27 13:44:07 PDT 2020
I'm diving slowly into s7, and I stumbled upon this
(define (inc! x)
(format #t "increasing x: ~A" x)
(set! x (+ 1 x))
(format #t "x is now ~A" x))
(define x 0)
x ;; x is still 0
What is my basic misunderstanding here?
Of course I could make a pure function (inc x), but I want to know what
I have the vague idea that one could manage to have this inc! function with
"box" from chez scheme is more or less the concept i'm going for
(set-box! x (+ (unbox x) 1)))])
(let ([b (box 3)])
(unbox b))) => 4
How does one implement this in s7?
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Cmdist