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

&rest, &key in macro parameter list



    Date: Fri, 12 Jan 90 15:59:41 MST
    From: intvax!gnome!drstrip@unmvax.cs.unm.edu (David R. Strip)

    Consider the following trivial macro
    (defmacro foo (a b &key c &rest d)`( ,a ,b ,c ,d))

Try this

  (defmacro foo (a b &rest d &key c &allow-other-keys)
    `(,a ,b ,c ,d))

That probably is not guaranteed to work since the existence of &key
implies keyword-value pairs, and the thing below does not do that.

    (foo a1 b1 :c c1 d1)
    When you try top expand the example, you get an error that
    the instance doesn't match the pattern.

    Am I blind to somthing too obvious too see, or is there
    something subtle here>
    Strip
    drstrip@sandia.gov