[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Predicates for all type specifier symbols
The old-fashioned type predicates are useful for sequence function tests and
the like. By using the same logic that gets us to the proposed functions TRUE
and FALSE, we can get to the old-fashioned type predicates.
At any rate, they save typing, as does CADDDR (which no one seems interested in
flushing). That the set of such predicates is incomplete calls for the
addition of functions to complete the set, rather than the elimination of all
type predicate functions. Back in the early Common Lisp days, one principal
guiding the design was "brain compataiblity" -- There are some things that will
cause more trouble in the short run due to programmers being unfamiliar with
new names or argument ordering or missing features or different functionality
than can be justified by streamlining the language.
I guarantee that if these functions are not provided, many major pieces of
portable software will define them for themselves, and some superset
implementations will provide them anyway, and porting such software will be
more of a hassle than it should be. I have seen this happen with ASSQ while
porting two systems (OPS-5 and PCL) in two Common Lisps (Symbolics and Spice).
The result is that the portable code now has hacks to define such functions
only if they don't already exist.
HOWEVER, if we were to nuke our old friends LISTP, ATOM, NUMBERP, and so on, we
could introduce something in the spirit of the proposed CONSTANT function to
make :TEST functions a wee bit easier to create.
(defun typefun (type)
#'(lambda (x) (typep x type)))
As with CONSTANT, this needn't cons a new function for each invocation -- it
could return constant functions for the common cases.