Nu Class Reference

NuMacro_1

The Nu implementation of a Lisp-like macro operator.

Superclass: NuMacro_0
Declared in: objc/Nu.h

Macros allow Nu programmers to arbitrarily extend the Nu language.

The macro operator works similarly to the Nu macro-0 operator, but differs in the following ways:

macro accepts a parameter list much like a Nu function. Nu's macro operator puts all of the parameter list into an implicit variable named margs, which the body of the macro must destructure manually.

macro does not implicitly "quote" the body of the macro. Instead the backquote (abbreviated as '`') and bq-comma (abbreviated as ',') operators can be used to write a macro body that more closely resembles the generated code.

For example, the following two macros are equivalent:

(macro-0 inc! (set (unquote (car margs)) (+ (unquote (car margs)) 1)))

(macro inc! (n) `(set ,n (+ ,n 1)))

Methods

- (NSString *) stringValue
Get a string representation of a macro.

in objc/Nu.h