You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
(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))))
That (do .. )feels like it shouldn't be necessary.
(Also the scoping issue requiring the fixed set! call is really starting to get on my nerves; both should be resolved I think - reported separately in #22.)
The text was updated successfully, but these errors were encountered:
This now allows the use of an arbitrary body, as can be seen
in the following test:
```
(set! p 4)
(while (<= p 10)
(print "Pxx: %s" p)
(set! p (+ p 1) true)
)
```
The new approach defines a local lambda, with a random name, and
calls that recursively when the conditional is true.
This closes#21, though we still need to use the three-argument
form of (set!) as our scoping/environment is confused - that is
tracked in #22.
I wrote a quick fibonacci generator like so:
That
(do .. )
feels like it shouldn't be necessary.(Also the scoping issue requiring the fixed
set!
call is really starting to get on my nerves; both should be resolved I think - reported separately in #22.)The text was updated successfully, but these errors were encountered: