Common Lisp the Language, 2nd Edition

next up previous contents index
Next: Type Specifiers That Up: Type Specifiers Previous: Type Specifier Lists

4.3. Predicating Type Specifiers

A type specifier list (satisfies predicate-name) denotes the set of all objects that satisfy the predicate named by predicate-name, which must be a symbol whose global function definition is a one-argument predicate. (A name is required; lambda-expressions are disallowed in order to avoid scoping problems.) For example, the type (satisfies numberp) is the same as the type number. The call (typep x '(satisfies p)) results in applying p to x and returning t if the result is true and nil if the result is false.

As an example, the type string-char could be defined as

(deftype string-char () 
  '(and character (satisfies string-char-p)))

See deftype.

X3J13 voted in March 1989 (COMMON-TYPE)   to remove the type string-char and the function string-char-p from the language.

It is not a good idea for a predicate appearing in a satisfies type specifier to cause any side effects when invoked.