Function Definitions

 7  -  Logic & Category Tests (Checks)

not ..... Returns T for null items, nil for non-nil items.  Compare null below.

(not nil)  returns T
(not ())  returns T
(not '())   returns T
(not 12.88)  returns nil
After (setq a "hello" b nil c 15.55)
(not a)  returns nil
(not b)  returns T
(not c)  returns nil


null ..... Tests for a null item or list.  Compare not above.

(null nil)  returns T
(null ())  returns T
(null '())  returns T
(null 12.88)  returns nil
After (setq a "hello" b nil c 15.55)
(null a)  returns nil
(null b)  returns T
(null c)  returns nil 


or ..... Tests for at least one non-nil expression among two or more

(or 2.51 nil)  returns T
(or nil '())  returns nil
(or nil '() nil 0.003 '())  returns T 



and ..... Tests for all T.   All arguments must evaluate to T (non-nil) in order for the and function to return T.

(and 1 T)  returns T
(and nil T)  returns nil
(arid 8 5 T "floor")  returns T
(and  (= 3 3) (= 4 4))  returns T
(and  (= 3 2) (= 4 4))  returns nil
After (setq b "bush")
(and b (< 9 75))  returns T


atom ..... Tests for an atom (as opposed to a list)

(atom k)  returns T
(atom 54.32)  returns T
(atom "several words in a phrase")  returns T
After (setq k (list 1 2 3))
(atom k)  returns nil


listp ..... Tests whether an item is a list

(listp (list 2.5 3.5))  returns T
(listp '(2.5 3.5))  returns T
(listp 2.5)  returns nil


boundp ..... Tests for a value bound to an atom

After (setq a "chair" b nil c 3.21)
(boundp 'a)  returns T  (notice that the variable is quoted)
(boundp 'b)  returns nil  (notice that the variable is quoted)
(boundp 'c)  returns T  (notice that the variable is quoted)


type ..... Returns an item's data type

After (setq a 15 b, 15.0 c "hello" d '(3.45 6.1))
(type 'a)  returns SYM (symbol)
(type a)  returns INT (integer)
(type b)  returns REAL (real or "floating point" decimal number)
(type c)  returns STR (string)
(type d)  returns LIST

Additional types are FILE (file descriptor), SUBR (subroutine), PAGETB (function paging table), PICKSET (selection set), and ENAME (entity name). The last two types are manipulated only by the ss... and ent... functions.


HOME


Copyright © 1988, 1998 Ronald W. Leigh