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
+18
View File
@@ -0,0 +1,18 @@
(define (make-counter) (let ((var 0.000000)) (lambda nil (mutate var (+ 1.000000 var)) var)))
(define counter1 (make-counter))
(assert (= (counter1) 1.000000))
(define counter2 (make-counter))
(assert (= (counter2) 1.000000))
(assert (= (counter2) 2.000000))
(assert (= (counter1) 2.000000))
(assert (= (counter1) 3.000000))
(assert (= (counter2) 3.000000))