Arc Forumnew | comments | leaders | submitlogin
3 points by jmatt 6063 days ago | link | parent

I think what you want is this:

  (mac meta(x . y) (+ x (car y)))
The way . works in parameters is that it is a list of the rest of the parameters that you are passing to the function/macro. This list could be empty/nil or contain one or more elements.

  arc> (mac meta (x . y) (prn x y))
  1(2)
  1
  arc> (meta 1)
  1()
  1
  arc> (is nil '())
  t
Don't forget that nil and the empty list are equivalent in arc.

EDIT: Added some explanation.