We can take lists apart using CAR and CDR("first" and "rest") and put them togetherwith CONS or LIST. The LENGTH function counts the number of elements in a list,which is the same as its number of top-level cons cells.
The important points about CAR and CDR are:
1.CAR and CDR accept only lists as input.
2.FIRST and REST are the same as CAR and CDR.
3.SECOND and THIRD are the same as CADR and CADDR.
4.Common Lisp provides built-in C...R functions for all combinations of CAR and
CDR up to and including four As and Ds.
The symbol NIL has several interesting properties:
1.NIL is a symbol. It is the only way to say "no" or "false" in Lisip.
2.NIL is the only Lisp object that is both a symbol and a list.
3.NIL marks the ends of a cons cell chain. When lists are printed in parenthesis
notation, theNILs at the end of chains are omitted by conversion.
4.NIL and () are intechangeable notations for the same object.
5.The CAR and CDR of NIL are defined to be NIL.
Functions covered in this chapter 2
List functions : FIRST,SECOND,THIRD,FOURTH,REST,CAR,CDR,CONS,LIST,LENGTH
Compositons of CAR and CDR:CAR CADDR,and so on.
Predicates: LISTP,CONSP,ATOM,NIL.
The NULL predicate returns T if its input is NIL. Its behavior is the same as the NOT
predicate. By convention,Lisp programmers reserver NOT for logical operations:
changing true to false and false to true.They use NULL when they want to test whether a list is empty.