Node: General Type Predicates, Next: , Previous: V-tables and Type Predicates, Up: Predicates



General Type Predicates

typeIs exp name Macro

typeIs returns t if the expression exp evaluates to an object whose type is exactly of the type name name and nil otherwise. Note that "exactly" implies that if name is a supertype of the object's type then false is returned. This macro is designed to be as fast a type check as possible and thus returns a low level C predicate, 0 for false and 1 for true. The returned result can easily be converted to the Lpp predicate with the pL macro if needed.

typep object type Function

typep returns t if the object object type or any supertype is the Type meta-object type and nil otherwise. Note that typep is different from typeIs in that any supertype of the object satisfies the test. Here are some examples of both.

     let n = L(56);
     pL(typeIs(n, Integer)) => t
     pL(typeIs(n, Number)) => nil
     typep(n, type(Number)) => t