-
Notifications
You must be signed in to change notification settings - Fork 0
Closed
Labels
wontfixThis will not be worked onThis will not be worked on
Description
This was spun off from the comment in #21.
There is a problem with scoping which can be revealed by this snippet:
(set! fib (fn* (n)
(if (<= n 1)
n
(+ (fib (- n 1)) (fib (- n 2))))))
(let* (n 0)
(while (<= n 10)
(do
(print (fib n))
(set! n (+ n 1) true))))
Specifically the "set! n" should update the value of the "n" variable inside the let-scope, but doesn't unless the "true" parameter is added.
There are three scopes here:
- The global scope, shared by everything before we execute code.
- A new scope introduced by the
(let*
binding. - A third scope entered when a function body is executed.
There's something not quite right about the effects when the function/let scope overlap.
Metadata
Metadata
Assignees
Labels
wontfixThis will not be worked onThis will not be worked on