主要的lisp 表達是例句

babyyellow發表於2013-06-19
(setf x '(a b c))
(setf y '(1 2 3))
The most important functions on lists are summarized here. The more complicated
ones are explained more thoroughly when they are used.


( f i r s t X) +a first element of a list
(second x) *b second element of a list
( t h i r d x) JC third element of a list
(nth 0 X) +a nth element of a list, 0-based
( r e s t x) + (b C) all but the first element
(car x) +a another name for the first element of a list
(cdr X) * (b C) another name for all but the first element
( l a s t x) =+ (c) last cons cell in a list
(length x) +3 number of elements in a list
(reverse x) +(c b a) puts list in reverse order
(cons 0 y) =+(O 1 2 3) add to front of list
(appendxy) +(abc123) append together elements
( l i s t x y) +((a b C) (1 2 3)) makeanewlist
( l i s t * 1 2 X) +(l 2 a b C) append last argument to others
( n u l l n i l ) +T predicate is true of the empty list
( n u l l x) + n i l . . . and false for everything else
(listp x) +T predicate is true of any list, including n i 1
(listp 3) + n i l . . . and is false for nonlists
(consp x) =+ t predicate is true of non-nil lists
(consp n i 1 1 =+ n i l . . . and false for atoms, including n i 1
(equal x x) =+ t true for lists that look the same
(equal x y) +nil . . . and false for lists that look different
( s o r t y #'>I + (3 2 1) sort a list according to a comparison function
(subseq x 1 2) + (B) subsequence with given start and end points


來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/133735/viewspace-764270/,如需轉載,請註明出處,否則將追究法律責任。

相關文章