Skip to content

While function should allow arbitrary body #21

@skx

Description

@skx

I wrote a quick fibonacci generator like so:

(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.)

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions