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

Predicates for types.

One reason to have specific predicates is efficiency. This is not just
an implementation detail hidden by the compiler, such as
	(typecase foo
	  (fixnum ...)
	  (integer ...)
	  (number ...)
	(typep foo 'number)
I admit the user should probably use those constructs instead of the -P
predicates and instead let the compiler do the fun.  Other constructs,
however, do not lend themselves to this abstraction.  Would you rather
	(count-if #'integerp sequence)
	(count-if #'(lambda (object) (typep object 'integer)) sequence)
?? In addition to which would you rather type, which would you rather
read in somebody else's code?