fixed let not coying the initial value nodes

This commit is contained in:
FelixBrendel
2019-03-15 01:14:45 +01:00
parent 6734ee2258
commit 31a833b5c9
10 changed files with 237 additions and 34 deletions
+16
View File
@@ -0,0 +1,16 @@
(define (make-counter)
(let ((var 0))
(lambda ()
(mutate var (+ 1 var))
var)))
(define counter1 (make-counter))
(assert (= (counter1) 1))
(define counter2 (make-counter))
(assert (= (counter2) 1))
(assert (= (counter2) 2))
(assert (= (counter1) 2))
(assert (= (counter1) 3))
(assert (= (counter2) 3))