What does the letter 't' mean in LISP?
ex:
(defun last2 (lst)
(cond ((null lst) nil)
((null (cdr lst)) (car lst))
(t (last2 (cdr lst)))))
My textbook is a coursepack so it doesn't quite explain all the meanings. Thanks.
T is the canonical true value in Common Lisp. Here it is being used as an ELSE, ensuring that the last branch of the COND is always true. (Any value other than NIL counts as true as well.)
See the glossary of the Common Lisp Hyperspec for t.
t n. 1. a. the boolean representing true. b. the canonical generalized boolean representing true. (Although any object other than nil is considered true as a generalized boolean, t is generally used when there is no special reason to prefer one such object over another.) ...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With