Arc Forumnew | comments | leaders | submitlogin
1 point by schtog 6055 days ago | link | parent

  (mac meta (x . y) 
      `(pr ,x ,@y))
arc> (meta 1 2 3 4 5) 123451

still dont see why the 1 is repeated in the end.



2 points by sacado 6054 days ago | link

Everything returns a value in arc, at least nil, or any other value. When you evaluate something through the REPL, the result is displayed. When you call 'pr, all the args are displayed, then the first arg is returned (then, displayed by the REPL). If you type, say

  (for i 1 10 (pr 1 2 3 4 5))
You will not see the 1 repeated on each iteration. It will print nil, though : that's the value returned by 'for.

-----

1 point by jmatt 6055 days ago | link

Check out the definition for pr on arcfn. http://www.arcfn.com/doc/io.html

Prints arguments using disp. Returns the first argument.

-----

1 point by tokipin 6054 days ago | link

here's a macro that prints them out more telligibly:

  (mac pr2 args
       (let l (len args)
         `(do
            (pr ,@(firstn (- l 1) args))
            ,(last args))))

-----