Arc Forumnew | comments | leaders | submitlogin
1 point by t1m 6131 days ago | link | parent

Does this work...

  (mac twodimlist (x y)
    `((twodimlist ,x) ,y))

?


1 point by kennytilton 6130 days ago | link

I see you have corrected the above by switching to a different name (a reasonable way to go) but it might be fun to see if you can stick with one and expand differently based on whether one or more than one value is supplied (meaning of course you need to support what we call &rest in CL in the parameter list of twodimlist. What I do not know is how well Arc likes to expand a macro into code referencing the same macro.

-----

1 point by t1m 6131 days ago | link

Oops, ignore the above. How about this...

  arc> (mac blah (n x y) `((,n ,x) ,y))
  #3(tagged mac #<procedure>)
  arc> (macex1 '(blah twodimlist 0 3))
  ((twodimlist 0) 3)

?

-----

2 points by sjs 6129 days ago | link

Arbitrary number of arguments:

  (mac drill (lst . xs)
    (if (no xs)       `,lst
        (no (cdr xs)) `(,lst ,(car xs))
        `((drill ,lst ,@(rev (cdr (rev xs)))) ,(last xs))))

-----