Macros

Arc's macro system is more similar to Lisp than to Scheme. Note that the 'mac' function is not part of the core, but is implemented on top of the core functions described below.

annotate type obj
Tags the object with the given type. Only used for macros.
>(type (annotate 'mac car))
mac
macex macro
Expands a macro.
>(macex '(let a 1 (pr a)))
((fn (a) (pr a)) 1)
macex1 macro
Expands a macro to one level.
>(macex1 '(let a 1 (pr a)))
(with (a 1) (pr a))
rep obj
Returns the underlying object for an annotated object
>(rep whilet)
#<procedure>
uniq
Generates a unique symbol.
>(uniq)
gs2607
quasiquote arg
The backquote ` is shorthand for quasiquote, e.g. `(+ 1 2) is the same as (quasiquote (1 2)). Inside quasiquote, the unquote operator will cause the contents to be evaluated instead of quoated. The unquote-splicing operator will cause contents to be evaluated and spliced into the result. , is shorthand for unquote, and ,@ is shorthand for unquote-splicing.
>`((+ 1 2) ,(+ 3 4) ,@(list 5 6))
((+ 1 2) 7 5 6)
quote arg
The single quote ' is shorthand for quote, e.g. 'x is the same as (quote x)
>'(1 2 3)
(1 2 3)

Copyright 2008 Ken Shirriff. /body>