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

non-list arguments



    Date: 30 Mar 86 22:19 PST
    From: Miller.pa at Xerox
    (apply (lambda (x . y) (+ x y)) (cons 1 2))

    Date: Mon, 31 Mar 1986  01:51 EST
    From: Scott E. Fahlman <Fahlman at C.CS.CMU.EDU>
    It certainly doesn't work in Common Lisp because lambda lists don't do
    destructuring in Common Lisp (though the argument lists for macros do
    destructure).

    Also, in Common Lisp you'd have to say "(function (lambda ...))".

I would translate the question into Common Lisp as:

  (apply (function (lambda (x &rest y) (+ x y))) (cons 1 2))

which eliminates the question of "descructuring", but I would guess still
preserves Ken Kahn's original question.  A strict reading of the Common
Lisp book would not require this to work, as far as I can see.  An
implementor would seem to be within his rights to insist that the last
argument to APPLY always be a proper list.