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

negative values for the :COUNT keyord argument



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