Nu Class Reference
NuMacro_1
The Nu implementation of a Lisp-like macro operator.
Superclass: NuMacro_0
Declared in: objc/Nu.h
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
- + macroWithName:parameters:body:
- - expand1:context:
- - evalWithArguments:context:
- - stringValue
- - initWithName:parameters:body:
| + | (id) | macroWithName: | (NSString *) name |
| parameters: | (NuCell*) args | ||
| body: | (NuCell *) body | ||
in objc/Nu.h
| - | (id) | expand1: | (id) margs |
| context: | (NSMutableDictionary *) calling_context | ||
in objc/Nu.h
| - | (id) | evalWithArguments: | (id) margs |
| context: | (NSMutableDictionary *) calling_context | ||
in objc/Nu.h
| - | (id) | initWithName: | (NSString *) name |
| parameters: | (NuCell *) args | ||
| body: | (NuCell *) body | ||
in objc/Nu.h