* "Pascal J. Bourguignon" <m28t04m...@despina.home> :
Wrote on Tue, 01 Jan 2019 14:52:22 +0100:
> The cases where we pass NIL to :test or :test-not, which is specified to
> signal a type-error, behaves as if they weren't passed.
You should be glad for that!
> 17.2.1 says that:
>
> "A :test argument, if supplied to F, is a designator for a function
> of two arguments, ..."
>
> NIL is not a designator for a function of two arguments, therefore
> it should be a type-error.
1. "if Non-NIL" is better phrasing than "if supplied" in this case;
supplying NIL means that no TEST is supplied.
The spec is usually explicit in specifying NIL when prompting for an
optional or keyword argument to be supplied. but there is one other
place I remember from the top of my head where there is a problem:
"encode-universal-time converts a time from Decoded Time format
to a universal time. If time-zone is supplied, no adjustment for
daylight savings time is performed."
This means that one has to call this function very carefully because of
perverse implementations:
(if (null time-zone)
(encode-universal-time second minute hour date month year)
(encode-universal-time second minute hour date month year
time-zone))
2. On the question of TEST and TEST-NOT here is the docstring for
INSERT-ORDERED from my cmucl-init (I have probably posted that here
before), where I use found a use for specifying both TEST and TEST-NOT:
(defun insert-ordered (item list &optional (predicate #'<)
&key key test test-not)
"Insert ITEM in LIST. may modify LIST. LIST is assumed to be
sorted by PREDICATE. If TEST (or TEST-NOT) is non-NIL, it is used
to determine if ITEM is present (or absent) in LIST, in which
case it is not inserted. KEY if non-NIL is applied to both ITEM
and elements of LIST before comparing them. However, unlike
section 17.2.1 of the spec, if both TEST and TEST-NOT are NIL, no
test is made.")
;; TEST could be specified to take precedence if both are supplied.