Suppose there's a LISP list L described by ((A B) (C))
How to print the result of (CAR L)
and (CDR L)
?
(in clisp interpreter)
I am able to print these simple statements like (CAR `(A B C)) which gives A. But how do I define the list and CAR it at the same time?
In Common Lisp you can print a value using, well, the print
procedure:
(defvar L '((A B) (C)))
(print (car L)) ; same as (print (car '((A B) (C))))
=> '(A B)
(print (cdr L)) ; same as (print (cdr '((A B) (C))))
=> '((C))