<div dir="ltr">Hi all,<br><br><div>I&#39;m diving slowly  into s7, and I stumbled upon this</div><div>---<br></div>(define (inc! x)<br>  (format #t &quot;increasing x: ~A&quot; x)<br>  (set! x (+ 1 x))<br>  (format #t &quot;x is now ~A&quot; x))<br><br>(define x 0)<br>(inc! x)<br>(inc! x)<br>x ;; x is still 0<br><div><br></div><div>---</div><div><br></div><div>What is my basic misunderstanding here?</div><div>Of course I could make a pure function (inc x), but I want to know what happens here.</div><div><br></div><div>I have the vague idea that one could manage to have this inc! function with environments.<br></div><div>&quot;box&quot; from chez scheme is more or less the concept i&#39;m going for</div><div><a href="https://cisco.github.io/ChezScheme/csug9.5/objects.html#./objects:s82">https://cisco.github.io/ChezScheme/csug9.5/objects.html#./objects:s82</a><br><br>(let ([incr!<br>       (lambda (x)<br>         (set-box! x (+ (unbox x) 1)))])<br>  (let ([b (box 3)])<br>    (incr! b)<br>    (unbox b))) =&gt; 4<br></div><div><br></div><div>How does one implement this in s7?<br><br></div><div>Thanks,<br></div><div>Christos<br></div><div><br></div></div>