PREDICATE FUNCTIONS
IS THIS AN ATOM?
(atom <expr>)
- <expr> the expression to check
- returns t if the value is an atom, NIL otherwise
IS THIS A SYMBOL?
(symbolp <expr>)
- <expr> the expression to check
- returns t if the expression is a symbol, NIL otherwise
IS THIS A NUMBER?
(numberp <expr>)
- <expr> the expression to check
- returns t if the expression is a number, NIL otherwise
IS THIS AN EMPTY LIST?
(null <expr>)
- <expr> the list to check
- returns t if the list is empty, NIL otherwise
IS THIS FALSE?
(not <expr>)
- <expr> the expression to check
- return t if the value is NIL, NIL otherwise
IS THIS A LIST?
(listp <expr>)
- <expr> the expression to check
- returns t if the value is a cons or NIL, NIL otherwise
IS THIS THE END OF A LIST?
(endp <list>)
- <list> the list
- returns t if the value is NIL, NIL otherwise
IS THIS A NON-EMPTY LIST?
(consp <expr>)
- <expr> the expression to check
- returns t if the value is a cons, NIL otherwise
IS THIS A CONSTANT?
(constantp <expr>)
- <expr> the expression to check
- returns t if the value is a constant (basically, would EVAL <expr> repeatedly return the same thing?), NIL otherwise.
IS THIS A SPECIAL SYMBOL?
(specialp <expr>)
- <expr> the expression to check
- returns t if the value is a symbol which is SPECIAL, NIL otherwise.
IS THIS AN INTEGER?
(integerp <expr>)
- <expr> the expression to check
- returns t if the value is an integer, NIL otherwise
IS THIS A FLOAT?
(floatp <expr>)
- <expr> the expression to check
- returns t if the value is a float, NIL otherwise
IS THIS A RATIONAL NUMBER?
(rationalp <expr>)
Part of math extension.
- <expr> the expression to check
- returns t if the value is rational (integer or ratio), NIL otherwise
IS THIS A COMPLEX NUMBER?
(complexp <expr>)
Part of math extension.
- <expr> the expression to check
- returns t if the value is a complex number, NIL otherwise
IS THIS A STRING?
(stringp <expr>)
- <expr> the expression to check
- returns t if the value is a string, NIL otherwise
IS THIS A CHARACTER?
(characterp <expr>)
- <expr> the expression to check
- returns t if the value is a character, NIL otherwise
IS THIS AN ARRAY?
(arrayp <expr>)
- <expr> the expression to check
- returns t if the value is an array, NIL otherwise
IS THIS A STREAM?
(streamp <expr>)
- <expr> the expression to check
- returns t if the value is a stream, NIL otherwise
IS STREAM OPEN?
(open-stream-p <stream>)
- <stream> the stream
- returns t if the stream is open, NIL otherwise
IS STREAM READABLE?
(input-stream-p <stream>)
- <stream> the stream
- returns t if stream is readable, NIL otherwise
IS STREAM WRITABLE?
(output-stream-p <stream>)
- <stream> the stream
- returns t if stream is writable, NIL otherwise
IS THIS AN OBJECT?
(objectp <expr>)
- <expr> the expression to check
- returns t if the value is an object, NIL otherwise
IS THIS A CLASS OBJECT?
(classp <expr>)
- <expr> the expression to check
- returns t if the value is a class object, NIL otherwise
IS A VALUE BOUND TO THIS SYMBOL?
(boundp <sym>)
- <sym> the symbol
- returns t if a value is bound to the symbol, NIL otherwise
IS A FUNCTIONAL VALUE BOUND TO THIS SYMBOL?
(fboundp <sym>)
- <sym> the symbol
- returns t if a functional value is bound to the symbol, NIL otherwise
IS THIS A FUNCTION?
(functionp <sym>)
Defined in common.lsp
- <expr> the expression to check
- returns t if the value is a function -- that is, can it be applied to arguments. This is true for any symbol (even those with no function binding), list with car being lambda, a closure, or subr. Otherwise returns NIL.
IS THIS NUMBER NEGATIVE?
(minusp <expr>)
- <expr> the number to test
- returns t if the number is negative, NIL otherwise
IS THIS NUMBER ZERO?
(zerop <expr>)
- <expr> the number to test
- returns t if the number is zero, NIL otherwise
IS THIS NUMBER POSITIVE?
(plusp <expr>)
- <expr> the number to test
- returns t if the number is positive, NIL otherwise
IS THIS INTEGER EVEN?
(evenp <expr>)
- <expr> the integer to test
- returns t if the integer is even, NIL otherwise
IS THIS INTEGER ODD?
(oddp <expr>)
- <expr> the integer to test
- returns t if the integer is odd, NIL otherwise
IS SET A SUBSET?
(subsetp <list1> <list2> &key :test :test-not :key)
- <list1> the first list
- <list2> the second list
- :test test function (defaults to eql)
- :test-not test function (sense inverted)
- :key function to apply to test function arguments (defaults to identity)
- returns t if every element of the first list is in the second list, NIL otherwise
ARE THE EXPRESSIONS EQUAL?
(eq <expr1> <expr2>)
(eql <expr1> <expr2>)
(equal <expr1> <expr2>)
(equalp <expr1> <expr2>)
equalp defined in common.lsp
- <expr1> the first expression
- <expr2> the second expression
- returns t if equal, NIL otherwise. Each is progressively more liberal in what is "equal":
- eq: identical pointers works with characters, symbols, and arbitrarily small integers
- eql: works with all numbers, if same type (see also = on page 57)
- equal: lists and strings
- equalp: case insensitive characters (and strings), numbers of differing types, arrays (which can be equalp to string containing same elements)
IS THIS A SPECIFIED TYPE?
(typep <expr> <type>)
- <expr> the expression to test
- <type> the type specifier. Symbols can either be one of those listed under type-of (on page 88) or one of:
- ATOM any atom
- NULL NIL
- LIST matches NIL or any cons cell
- STREAM any stream
- NUMBER any number type
- RATIONAL fixnum or ratio (math extension)
- STRUCT any structure (except hash-table)
- FUNCTION any function, as defined by functionp (page 69)
The specifer can also be a form (which can be nested). All form elements are quoted. Valid form cars:
- or any of the cdr type specifiers must be true
- and all of the cdr type specifiers must be true
- not the single cdr type specifier must be false
- satisfies the result of applying the cdr predicate function to <expr>
- member <expr> must be eql to one of the cdr values
- object <expr> must be an object, of class specified by the single cdr value. The cdr value can be a symbol which must evaluate to a class.
Note that everything is of type T, and nothing is of type NIL.
- returns t if <expr> is of type <type>, NIL otherwise.
XLISP-PLUS - Version 2.1g - Tom Almy
tom.almy@tek.com - 18 JUL 94
Generated with WebMaker