Arc Forumnew | comments | leaders | submitlogin
1 point by diiq 5275 days ago | link | parent

Right, so the major difference between a traditional closure and a closure in Eight is that a closure in Eight still looks and acts just like a list. I can do this:

     (def foo ('bar)
        (print (car bar)))

     (foo (+ 2 3))
And what would be printed is:

+

Which is not useful, but it's how you'd expect a macro to work. But in Arc, once you've wrapped something in (fn) to make a closure, it becomes inaccessible; I can't do:

    (pr (car (fn () (+ 2 3))))
EDIT: I didn't answer the question.

    (set! a 10)
    (while (> a 3) (print "hello") (set! a (- a 1)))
Which outputs:

hellohellohellohellohellohellohello()

[Warning to those you want to try this in the Eight interpreter, - and + are not implemented yet, use 'minus' and 'plus']