[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
negative values for the :COUNT keyord argument
- To: common-lisp@sail.stanford.edu
- Subject: negative values for the :COUNT keyord argument
- From: Dave.Touretzky@B.GP.CS.CMU.EDU
- Date: Sun, 21 Aug 88 03:45:56 EDT
- Reply-to: Dave.Touretzky@cs.cmu.edu
According to the way I read CLtL (pages 247 and 253), a negative value for
the :COUNT keyword, e.g., to REMOVE, is legal and should behave the same as
zero:
(remove #\a "Banana" :count -10) ==> "Banana"
Apparently, not everyone shares this view.
CMU Common Lisp treats negative values like NIL:
* (remove #\a "Banana" :count -10)
"Bnn"
The June 3, 1987 version of KCL treats a negative value as how many spaces
to tack on to the end of the string. It appears to handle lists correctly,
but not vectors:
> (remove #\a "Banana: :count -10)
"Banana "
> (remove 'a '(b a n a n a) :count -10
(B A N A N A)
> (remove 'a '#(b a n a n a) :count -2)
(B A N A N A NIL NIL)
I don't see anything in the manual to indicate that it "is an error" to
supply negative values for the :COUNT keyword. Anybody want to rule on
what the legal behavior is in this case?
-- Dave