The 'endp' predicate function checks to see if 'list' is an empty list. T is returned if the list is empty, NIL is returned if the list is not empty. The 'list' has to be a valid list. An error is returned if it is not a list:
error: bad argument type
(endp '()) ; returns T - empty list (endp ()) ; returns T - still empty (endp '(a b c)) ; returns NIL (setq a NIL) ; set up a variable (endp a) ; returns T - value = empty list (endp "a") ; error: bad argument type - "a" (endp 'a) ; error: bad argument type - A
Note: The 'endp' predicate is different from the null and not predicates in that it requires a valid list.
See the
endp
predicate function in the