Re: Defmacro Signature



(message (Hello 'Michael)
(you :wrote :on '(Wed, 31 Jan 2007 22:13:55 +0100))
(

MB> I found this macro-lambda-list in a lisp source file written by Edi
MB> Weitz.

MB> (defmacro insert-char-class-tester ((char-class chr-expr) &body body)
MB> ^^^^^^^^^^^^^^^^^^^^^
MB> I can't see how this definition conforms to the hyperspec:

MB> http://www.lispworks.com/documentation/HyperSpec/Body/03_dd.htm
MB> reqvars::= var*

and why do you think var is an atom here? read more careful!

Destructuring allows a macro lambda list to express the structure of a macro
call syntax.

http://www.lispworks.com/documentation/HyperSpec/Body/03_dda.htm

3.4.4.1 Destructuring by Lambda Lists

Anywhere in a macro lambda list where a parameter name can appear, and where
ordinary lambda list syntax (as described in Section 3.4.1 (Ordinary Lambda
Lists)) does not otherwise allow a list, a destructuring lambda list can
appear in place of the parameter name. When this is done, then the argument
that would match the parameter is treated as a (possibly dotted) list, to be
used as an argument list for satisfying the parameters in the embedded
lambda list. This is known as destructuring.

MB> Is this form often used in macro-definitions??

yes

)
(With-best-regards '(Alex Mizrahi) :aka 'killer_storm)
"People who lust for the Feel of keys on their fingertips (c) Inity")


.



Relevant Pages

  • Re: destructuring-bind on infinite lists?
    ... A destructuring pattern can contain CAR leaves which are NIL. ... The 1 in the data is matched by which is the atom NIL, ... (Ordinary Lambda Lists)) ...
    (comp.lang.lisp)
  • Re: Why no destructuring in ordinary lambda lists?
    ... >Is there a deep reason that ordinary lambda lists don't support ... >DESTRUCTURING-BIND to do runtime destructuring. ... I can imagine needing to destructure the arguments to an ordinary function ... is if it's being used as an auxiliary by a macro, but even in this case I ...
    (comp.lang.lisp)
  • Re: Why no destructuring in ordinary lambda lists?
    ... >>Is there a deep reason that ordinary lambda lists don't support ... > not a complex list that's amenable to destructuring. ... I think historically the reason it's not in arglists is that ... Consider an operation like cadr, ...
    (comp.lang.lisp)
  • Re: choices sample Logo -> Lisp
    ... That one applies to macro lambda lists, ... "The lambda-list supports destructuring as described in Section 3.4.5 ...
    (comp.lang.lisp)
  • Re: Need help with use of inner-lambda lists in defmacro
    ... Destructuring by Lambda Lists ... (Ordinary Lambda Lists)) ... destructuring lambda list can appear in place of the parameter name. ... CL-USER> (foo a b c d e) ...
    (comp.lang.lisp)