An explanation of nil In Emacs Lisp, the symbol nil has two meanings. First, it means the empty list. Second, it means false and is the value returned when a true-or-false-test tests false. nil can be written as an empty list, () , or as nil .
The empty list is also known as nil, it's written representation is either the literal nil or the empty list: ().
Lisp includes a number of functions that give a true or false answer - they are called predicates, and often (but not always) have names ending with p. In Lisp the convention is that nil, or the empty list, means false, and anything else means true.
Scheme provides a procedure, null? to check whether a value is (a pointer to) the empty list, i.e., a null pointer. For example, (null? foo) returns #t if the value of the variable foo is the empty list, and #f otherwise.
I am so sorry for having to ask this question but I'm trying to do a simple if statement that checks if a variable is nil or not.
(defun test (input)
(let ((testvar (first input)))
(if (not nil testvar)
(do this)
(do that))))
Could anyone explain the proper syntax to me?
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