483
Comment:
|
1616
|
Deletions are marked like this. | Additions are marked like this. |
Line 4: | Line 4: |
|| Symbolic expressions / or just expressions |||| Atoms and lists collectively are called expressions. |||| || || setf |||| (setf <name> <list>) creates a set called <name> that has the value <list> |||| (setf friends '(Dan Randy)) || |
|| Symbolic expressions / or [s-]expressions |||| Atoms and lists collectively are called expressions. |||| || || setf |||| (setf [<name> <list>]*) is an assignment of <list> to <name> |||| (setf friends '(Dan Randy) enemies '(Satan)) || || Data Types |||| See Figure 1 |||| || || FIRST |||| (FIRST LIST) returns the first expression in the list |||| (FIRST (A B C)) --> A || || REST |||| (REST LIST) returns the expression after the first element of the list as a list |||| (REST (A B C)) --> (B C) || || QUOTE |||| '(I J) will return a list with the elements I and J without trying to interpret I as a function |||| '(A B C) --> (A B C)|| || CARs CDRs |||| CAR == first, CDR == rest. Add a's or d's to string them to gether CADR == first rest |||| (CADR '(A B C)) --> B || || True and False |||| T and NIL |||| || || CONS |||| (CONS <exp> <list>) --> LIST == (exp list[1] ... list[n]) that is the contents of the list |||| (CONS 'a '(b c)) --> (a b c) || || APPEND |||| (APPEND list list*) --> (content contents1 ... contentsn) |||| (append '(a b c) '(a e f)) --> (a b c a e f) || LIST |||| (LIST <exp>*) --> (exp1 ... expn) |||| (LIST 'a 'b 'c) --> (a b c) || {{{ |Number | |Atom---| | | Expressions -| |Symbol | |LIST }}} Figure 1 |
Term |
Definition |
Example |
||
Atoms |
Like types: the fundamental items formed from bits |
27, 3.14, This-Phrase |
||
Lists |
Sentence like objects containing atoms or other lists. |
'(this that the other thing) |
||
Symbolic expressions / or [s-]expressions |
Atoms and lists collectively are called expressions. |
|
||
setf |
(setf [<name> <list>]*) is an assignment of <list> to <name> |
(setf friends '(Dan Randy) enemies '(Satan)) |
||
Data Types |
See Figure 1 |
|
||
FIRST |
(FIRST LIST) returns the first expression in the list |
(FIRST (A B C)) --> A |
||
REST |
(REST LIST) returns the expression after the first element of the list as a list |
(REST (A B C)) --> (B C) |
||
QUOTE |
'(I J) will return a list with the elements I and J without trying to interpret I as a function |
'(A B C) --> (A B C) |
||
CARs CDRs |
CAR == first, CDR == rest. Add a's or d's to string them to gether CADR == first rest |
(CADR '(A B C)) --> B |
||
True and False |
T and NIL |
|
||
CONS |
(CONS <exp> <list>) --> LIST == (exp list[1] ... list[n]) that is the contents of the list |
(CONS 'a '(b c)) --> (a b c) |
|| APPEND |||| (APPEND list list*) --> (content contents1 ... contentsn) |||| (append '(a b c) '(a e f)) --> (a b c a e f)
LIST |
(LIST <exp>*) --> (exp1 ... expn) |
(LIST 'a 'b 'c) --> (a b c) |
|Number | |Atom---| | | Expressions -| |Symbol | |LIST
Figure 1