[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Pushing defmacro hard: destructured &KEY bindings



    Date: Thu, 22 Jan 87 17:43 EST
    From: David C. Plummer <DCP@quabbin.scrc.symbolics.com>
    Subject: Pushing defmacro hard: destructured &KEY bindings

    CLtL pages 149-151 mentions destructuring within lambda list keywords
    for defmacro, but don't give enough examples for users to know what is
    expected to work and what isn't.  Specifically, it does give examples of
    destructuring &OPTIONAL, but doesn't say &REST may not be destructured
    (it doesn't at first glance make much sense, but program writing
    programs may generate it, and it may be a good way to do some further
    destructuring) and it is silent on &KEY.  For example, is the following
    legal?

p146 CLtL ... known as destructuring.
"Anywhere in the lambda-list where a parameter name may
appear, and where ordinary lambda-list syntax (5.2.2) does not otherwise
allow a list, a lambda-list may appear in place of the parameter name."

So I'd interpret that to mean any of the following "var"s in
lambda-lists may be replaced with a lambda-list.
( {var}*
  &optional (var [initform [svar]])
  &rest var
  &key ((key var) [initform [svar]]).
)

I'd say your examples are valid.

-jeff