17.05.2015 Views

zl:1 - FTP

zl:1 - FTP

zl:1 - FTP

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

lambda-macro 284<br />

I<br />

&whole<br />

This is for macros defined by defmacro or macrolet only. &whole<br />

is followed by variable, which is bound to the entire macro-call form<br />

or subform. variable is the value that the macro-expander function<br />

receives as its first argument. &whole is allowed only in the toplevel<br />

pattern, not in inside patterns.<br />

See the section "&-Keywords Accepted By defmacro" in Symbolics<br />

Common Lisp: Language Concepts.<br />

&environment<br />

This is for macros defined by defmacro or macrolet<br />

only.&environment is followed by variable, which is bound to an object<br />

representing the lexical environment where the macro call is to<br />

be interpreted. This environment might not be the complete lexical<br />

environment. It should be used only with the macroexpand function<br />

for any local macro definitions that the macrolet construct might<br />

have established within that lexical environment. &environment is<br />

allowed only in the top-level pattern, not in inside patterns. See the<br />

section "Lexical Environment Objects and Arguments" in Symbolics<br />

Common Lisp: Language Concepts.<br />

See the section "&-Keywords Accepted By defmacro" in Symbolics<br />

Common Lisp: Language Concepts.<br />

lambda-macro name lambda-list body... Special Form<br />

Like macro, defines a lambda macro to be called name. lambda-list should<br />

be a list of one variable, which is bound to the function being expanded.<br />

The lambda macro must return a function. Example:<br />

(lambda-macro ilisp (x)<br />

'(lambda (&optional ,@(second x) &rest ignore) . , (cddr x»)<br />

This defines a lambda macro called ilisp. After it has been defined, the<br />

following list is a valid Lisp function:<br />

(ilisp (x y z) (list x y z»<br />

The above function takes three arguments and returns a list of them, but<br />

all of the arguments are optional and any extra arguments are ignored.<br />

(This shows how to make functions that imitate Interlisp functions, in<br />

which all arguments are always optional and extra arguments are always<br />

ignored.) So, for example:<br />

(funcall #'(ilisp (x y z) (list x y z» 1 2) => (1 2 nil)

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!