Arc Forumnew | comments | leaders | submitlogin
4 points by absz 6082 days ago | link | parent

Your Let fails on destructuring:

  (def mag (vec)
    (let (x y) vec
      (expt (+ (* x x) (* y y)) 1/2)))
Your Let would fail there, trying to bind x to y.


1 point by tokipin 6082 days ago | link

ah, didn't know you could do that. thanks

-----

1 point by absz 6082 days ago | link

To be fair, that example would be more simply written

  (def mag ((x y))
    (expt (+ (* x x) (* y y)) 1/2))
, but destructuring in let does have real uses.

-----