Lisp (null (QUOTE NIL)) returns NIL -
Lisp (null (QUOTE NIL)) returns NIL -
i new lisp , i'm trying simple check see if list empty. test purposes created test function:
(defun test (list) (if (null (caddr list)) (make-node 1) (caddr list))) if uses make-node function defined as:
(defun make-node (atm) (cons atm `(`() `()))) when running (make-node 6) get:
(6 (quote nil) (quote nil))
which want.
i phone call (test (make-node 6)) get:
(quote nil) which (caddr list) test. if run (null (quote nil)) t want when run given test function receive nil.
so question why when check if null why nil instead of t?
when evaluate (null (quote nil)), (quote nil) evaluated, resulting in nil beingness used argument function null.
however when evaluate (null (function-returning-quote-nil)), function-returning-quote-nil evaluated, resulting in list (quote nil) used argument function null without farther evaluation.
compare difference between
(null (quote nil)) ; => t
and
(null '(quote nil)) ; => nil
lisp null nested-lists
Comments
Post a Comment