Arc Forumnew | comments | leaders | submitlogin
1 point by lojic 6104 days ago | link | parent

Thanks. And from your comment ( http://arclanguage.com/item?id=4432 ) on the 8 Queens thread, the Ruby snippet in the OP above could be implemented as:

  (def foo (xs)
    (point return
           (each x xs
                 (if (> x 3)
                     (return x)))
           nil))

  (prn (foo '(1 2 3 4 5)))


2 points by almkglor 6104 days ago | link

Yes. Although breakable: is significantly more concise.

Edit: Another alternative to breakable: ... break is catch: ... throw ^^

-----

4 points by lojic 6104 days ago | link

But breakable isn't in Arc :)

-----

2 points by almkglor 6104 days ago | link

It's only six more nodes of code ~.~;

That said catch-throw is in ArcN, although they do have different intended usages. breakable: is supposed to be used as a modifier for existing control structures, while (catch ...) is supposed to be a control structure in its own right.

-----