Arc Forumnew | comments | leaders | submitlogin
1 point by ryantmulligan 5917 days ago | link | parent

I may be mistaken, but isn't this destructuring already done by function definitions. I mean you can write:

  (def bob args progn)
and args is properly bound to the list of arguments. Or you can choose to do

  (def bob (a b c . rest) progn)
and it's bound that way.

  arc> (def bob (a b (c d . rest1 ) . rest2) ( prn a b c d rest1 rest2))
  *** redefining bob
  #<procedure: bob>
  arc> (bob 1 2 '(3 4) 5 6 7)
  1234nil(5 6 7)
  1
  arc> (bob 1 2 '(3 4 5 6) 7 8 9)
  1234(5 6)(7 8 9)
You see it's already doing the destructuring you want, without some complex syntax for it. The above code is arc0 I make no claims for it's functioning in arc1.


4 points by drcode 5917 days ago | link

he also wants to assign multiple names at different levels of the destructuring, so it is different.

It's great in Haskell, but I think it is pretty un-arcy, due to the increase in complexity.

-----

3 points by ryantmulligan 5917 days ago | link

Oh I think I see. He has two names for one part of the code. like combining:

  (def bob args progn)
  (def bob (a b c) progn)
then inside the progn you could refer to '(a b c) as args or it's components.

-----