Arc Forumnew | comments | leaders | submitlogin
2 points by almkglor 6096 days ago | link | parent

If you're on arc-wiki, you can use the breakable: modifier to create a breakable with/let:

  (def valid (stack)
    (breakable:let q2 (- len.stack 1)
      (each q1 (range 0 (- len.stack 2))
        (if (or (is stack.q1 stack.q2) (is (abs:- q1 q2) (abs:- stack.q1 stack.q2)))
          (break nil)))
      (break t)))
edit: BTW, your 'valid function didn't actually return the result ^^


1 point by sacado 6095 days ago | link

oh, right, each returns nil...

Thks for the "breakable" info

-----