Arc Forumnew | comments | leaders | submitlogin
1 point by evanrmurphy 5325 days ago | link | parent

Maybe there's a workaround involving quotes. Borrowing from fallintothis' example, 'baz interprets 'm as the macro:

  arc> (mac m (x) `(list 'expanded ',x))
  #(tagged mac #<procedure: m>)
  arc> (def baz (m index) (m index))
  #<procedure: baz>
  arc> (baz "abc" 0)
  (expanded index)
The following 'baz1 interprets it as the parameter:

  arc> (def baz1 (m index) `(,m ,index))
  #<procedure: baz1>
  arc> (baz1 "abc" 0)
  ("abc" 0)
Are there problems with this approach?


2 points by rocketnia 5325 days ago | link

I thought the point of 'baz was to call the first parameter with the second parameter. That is, the result of (baz "abc" 0) would be the character #\a if not for that meddling macro. Your 'baz1 is totally different.

BTW, here's my version of 'baz: (def baz (m index) do.m.index)

-----

1 point by evanrmurphy 5325 days ago | link

Yes, you are right. My 'baz1 doesn't work as intended.

-----