2021-12-29 02:09:51 +00:00
|
|
|
; https://github.com/munificent/craftinginterpreters/blob/master/test/closure/assign_to_shadowed_later.lox
|
|
|
|
|
|
|
|
(define a 0)
|
|
|
|
|
2021-12-29 02:32:43 +00:00
|
|
|
(define (displayln x)
|
|
|
|
(display x)
|
|
|
|
(newline))
|
2021-12-29 02:09:51 +00:00
|
|
|
|
2021-12-29 02:32:43 +00:00
|
|
|
((lambda ()
|
|
|
|
(define (assign)
|
|
|
|
(set! a 1))
|
2021-12-29 02:09:51 +00:00
|
|
|
|
2021-12-29 02:32:43 +00:00
|
|
|
(define a 2)
|
|
|
|
(assign)
|
|
|
|
(displayln a)))
|
2021-12-29 02:09:51 +00:00
|
|
|
|
2021-12-29 02:32:43 +00:00
|
|
|
(displayln a)
|