|| 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 [ ]*) is an assignment of to ||||<(> (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 ) --> 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 *) --> (exp1 ... expn) ||||<(> (LIST 'a 'b 'c) --> (a b c) || || NTHCDR ||||<(> (NTHCDR ) trims off the first items from the list and returns the rest ||||<(> (NTHCDR 2 '(a b c)) --> (c) || || BUTLAST ||||<(> (BUTLAST ) trims off the last itmes from the list and returns the rest ||||<(> (BUTLAST 2 '(a b c)) --> (a) || || LAST ||||<(> (LAST ) --> (last-element) as a list ||||<(> (LAST '(a b c)) --> (c) || || LENGTH ||||<(> (LENGTH ) --> number of items in the list ||||<(> (LENGTH '(a b c)) --> 3 || || REVERSE ||||<(> (REVERSE ) --> reverses the order of the list ||||<(> (REVERSE '(a b c)) --> (c b a) || || Association list / a-list ||||<(> A list of sublists where the first element in each sublist is used as a key for recovering the entire list. ||||<(> (setf Patti '((height 5-10) (weight 124))) where height and weight are the keys || || ASSOC ||||<(> Is a way to access a-lists (ASSOC ) ||||<(> (ASSOC 'weight Patti) --> 124 || || FLOAT ||||<(> Forces a float result (FLOAT ) --> float-value ||||<(> (float (/ 22 7)) --> 3.14286 vs. (/ 22 7) --> 22/7 which is a ratio || || ROUND ||||<(> (ROUND ) --> int remainder ||||<(> (round (/ 22 7)) --> 3 1/7 || || MAX ||||<(> (MAX ) --> max element in list ||||<(> (max '(1 2 3)) --> 3 || || MIN ||||<(> (MIN ) --> min element in list ||||<(> similar || || EXPT ||||<(> Stand for exponent (expt number1 number2) --> number1^number2 ||||<(> (expt 2 3) --> 8 || || bind ||||<(> means to reserver a place in memory - this is similar to definition in other languages ||||<(> no example || || form ||||<(> ??? ||||<(> ??? || || DEFUN ||||<(> (DEFUN (parem-list)
) ||||<(> (defun bothends (whole-list) (cons (first whole-list) (last whole-list))) || || pass by value ||||<(> Values passed in as params are passed by value. All other values can be changed. ||||<(> || || LET ||||<(> (let (( ) ... ( ... ) Let is said to evaluate it initial value formes in parallel because all initial value formes are evaluated before the fence for eht LET is builtand before any of the LET's parameters are bound ||||<(> See Figure 2 for an example || || Comments ||||<(> Use the semicolon twice ;; ||||<(> ;;this is a comment || || EQUAL ||||<(> (EQUAL ) --> {T, NIL} ||||<(> (equal '(a b) '(a b)) --> T (equal '(a b) 'c) --> NIL || || EQL ||||<(> Are two argument values the same symbol or number? ||||<(> || || EQ ||||<(> Are two argument values the same symbol ||||<(> || || = ||||<(> Are two argument values the same number ||||<(> || || MEMBER ||||<(> (MEMBER ) returns true if is a member of the list. '''Member tests using EQL''' ||||<(> (MEMBER '(a b) '((a b) (c d))) --> true || || :KEYWORD ||||<(> Any symbol beginning with a : is a keyword. we can insert :test #'equal to force the test type in MEMBER ||||<(> (member '(maple shade) pairs :test #'equal) || || Procedure Name/Object ||||<(> Procedure name is the actual handle we use such as EQUAL. The proceduce object is the code that actually performs the computation. ||||<(> See Lisp p 52 || || LISTP ||||<(> (LISTP ) --> T if is a list ||||<(> || || ATOM ||||<(> (ATOM ) --> T if is an atom ||||<(> || || NUMBERP ||||<(> (NUMBERP ) --> T if is a number ||||<(> || || SYMBOLP ||||<(> (SYMBOLP ) --> T if is a symbol ||||<(> || || NIL == () ||||<(> ||||<(> || || NULL ||||<(> (NULL ) --> T if is an empty list or NIL ||||<(> || || ENDP ||||<(> (ENDP ) --> T if is a list and its an empty list ||||<(> || || ZEROP ||||<(> Is it zero? ||||<(> (ZEROP 0) --> T || || PLUSP ||||<(> Is it positive ||||<(> (PLUSP 3) --> T || || MINUSP ||||<(> Is it negative ||||<(> (MINUSP -3) --> T || || EVENP/ODDP ||||<(> is it even or odd ||||<(> (EVENP 2) --> T (ODDP 2) --> NIL || || >, < ||||<(> ... ||||<(> (< 3 4) --> T || || AND/OR ||||<(> (AND/OR ... ) --> {T,NIL} uses short circuit evaluation always ||||<(> || || NOT ||||<(> (NOT ) --> {T,NIL} ||||<(> || || IF ||||<(> (IF ) ||||<(> || || WHEN ||||<(> (WHEN ) ||||<(> || || UNLESS ||||<(> (UNLESS ) ||||<(> || || COND ||||<(> (COND ( *)*) uses short circuit evaluation - it will only evaluate one. You should have the last one equal T as a sort of otherwise condition. ||||<(> || || CASE ||||<(> (CASE ( * )* uses EQL to compare, case returns NIL if nothing is triggered, T or OTHERWISE can be used for the default. {{{ |Integer | |Number---|Ratio | | | |Floating Point |Atom---| | | Expressions -| |Symbol | | | |Empty List |List---| |Cons }}} Figure 1 {{{ (setf x 'outside) (let ((x 'inside) (y x)) (list x y) ) (INSIDE OUTSIDE) //NOTE y gets the value of x outside the fence for the LET. }}} Figure 2