[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
non-list arguments
OK, for Common Lisp how about:
(apply #'(lambda (x &rest y) (+ x y)) (cons 1 2))
Ah, I see what you're driving at now.
No this is not guaranteed to work in Common Lisp in my opinion. The
second argument to apply is a list of operands. In this case, you've
got a list of one operand, 1, with a particularly ugly terminator, so
the rest arg, Y, should end up bound to NIL. Some implementations may
get this "right" by accident, but in most of them the Apply takes apart
the operand list and simulates a call to the function. The lambda would
be called with only one arg, and the rest arg would be NIL. The 2 has
been discarded before the function ever gets called.
-- Scott