[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Date: Thu, 5 Nov 87 22:27 EST
From: David A. Moon <Moon@STONY-BROOK.SCRC.Symbolics.COM>
I don't see why (collect '(a b c)) isn't invalid for the same
reason. The list method becomes inapplicable in the recursive call.
Oops, your right. What I spaced on at the time was that I wasn't change
the applicable set of next methods so it was OK. Should that in fact be
If not, here is a corrected example.
(defmethod collect (thing) thing)
(defmethod collect ((n number))
(let ((l ()))
(dotimes (i n)
(push (call-next-method) l))
(defmethod collect ((l list))
(mapcar #'call-next-method l))
(collect 5) ==> (5 5 5 5 5)
(collect '(() () ())) ==> (() () ())
;;; But note the following erroneous use of call-next-method.
;;; This example would cause an error to be signalled because
;;; the argument which is supplied to call-next-method would
;;; cause a different set of methods to be applicable.
(collect '(1 2 3))