LIST FUNCTIONS
RETURN THE CAR OF A LIST NODE
(car <expr>)
- <expr> the list node
- returns the car of the list node
RETURN THE CDR OF A LIST NODE
(cdr <expr>)
- <expr> the list node
- returns the cdr of the list node
ALL CxxR COMBINATIONS
(cxxr <expr>)
ALL CxxxR COMBINATIONS
(cxxxr <expr>)
ALL CxxxxR COMBINATIONS
(cxxxxr <expr>)
A SYNONYM FOR CAR
(first <expr>)
A SYNONYM FOR CADR
(second <expr>)
A SYNONYM FOR CADDR
(third <expr>)
A SYNONYM FOR CADDDR
(fourth <expr>)
A SYNONYM FOR CDR
(rest <expr>)
CONSTRUCT A NEW LIST NODE
(cons <expr1> <expr2>)
- <expr1> the car of the new list node
- <expr2> the cdr of the new list node
- returns the new list node
ADD TO FRONT OF ASSOC LIST
(acons <expr1> <expr2> <alist>)
defined in common.lsp
- <expr1> key of new association
- <expr2> value of new association
- <alist> association list
- returns new association list, which is (cons (cons <expr1> <expr2>) <expr3>))
CREATE A LIST OF VALUES
(list <expr>...)
(list* <expr> ... <list>)
- <expr> expressions to be combined into a list
- returns the new list
APPEND LISTS
(append <expr>...)
- <expr> lists whose elements are to be appended
- returns the new list
FIND THE LENGTH OF A LIST
(list-length <list>)
- <list> the list
- returns the length of the list or NIL if the list is circular
RETURN THE LAST LIST NODE OF A LIST
(last <list>)
- <list> the list
- returns the last list node in the list
RETURN COPY OF ALL BUT LAST OF LIST
(butlast <list> [<n>])
- <list> the list
- <n> count of elements to omit (default 1)
- returns copy of list with last element(s) absent.
RETURN THE NTH ELEMENT OF A LIST
(nth <n> <list>)
- <n> the number of the element to return (zero origin)
- <list> the list
- returns the nth element or NIL if the list isn't that long
RETURN THE NTH CDR OF A LIST
(nthcdr <n> <list>)
- <n> the number of the element to return (zero origin)
- <list> the list
- returns the nth cdr or NIL if the list isn't that long
FIND AN EXPRESSION IN A LIST
(member <expr> <list> &key :test :test-not :key)
- <expr> the expression to find
- <list> the list to search
- :test the test function (defaults to eql)
- :test-not the test function (sense inverted)
- :key function to apply to test function list argument (defaults to identity)
- returns the remainder of the list starting with the expression
FIND AN EXPRESSION IN AN A-LIST
(assoc <expr> <alist> &key :test :test-not :key)
- <expr> the expression to find
- <alist> the association list
- :test the test function (defaults to eql)
- :test-not the test function (sense inverted)
- :key function to apply to test function list argument (defaults to identity)
- returns the alist entry or NIL
APPLY FUNCTION TO SUCCESSIVE CARS
(mapc <fcn> <list1> <list>...)
- <fcn> the function or function name
- <listn> a list for each argument of the function
- returns the first list of arguments
APPLY FUNCTION TO SUCCESSIVE CARS
(mapcar <fcn> <list1> <list>...)
- <fcn> the function or function name
- <listn> a list for each argument of the function
- returns a list of the values returned
APPLY FUNCTION TO SUCCESSIVE CDRS
(mapl <fcn> <list1> <list>...)
- <fcn> the function or function name
- <listn> a list for each argument of the function
- returns the first list of arguments
APPLY FUNCTION TO SUCCESSIVE CDRS
(maplist <fcn> <list1> <list>...)
- <fcn> the function or function name
- <listn> a list for each argument of the function
- returns a list of the values returned
APPL FUNCTION TO SUCCESSIVE CARS
(mapcan <fcn> <list1> <list>...)
- <fcn> the function or function name
- <listn> a list for each argument of the function
- returns list of return values nconc'd together
APPL FUNCTION TO SUCCESSIVE CDRS
(mapcon <fcn> <list1> <list>...)
- <fcn> the function or function name
- <listn> a list for each argument of the function
- returns list of return values nconc'd together
(subst <to> <from> <expr> &key :test :test-not :key)
SUBSTITUTE EXPRESSIONS
(nsubst <to> <from> <expr> &key :test :test-not :key)
SUBST does minimum copying as required by Common Lisp. NSUBST is the destructive version.
- <to> the new expression
- <from> the old expression
- <expr> the expression in which to do the substitutions
- :test the test function (defaults to eql)
- :test-not the test function (sense inverted)
- :key function to apply to subtree test function expression argument (defaults to identity)
- returns the expression with substitutions
(sublis <alist> <expr> &key :test :test-not :key)
SUBSTITUTE WITH AN A-LIST
(nsublis <alist> <expr> &key :test :test-not :key)
SUBLIS does minimum copying as required by Common Lisp. NSUBLIS is the destructive version.
- <alist> the association list
- <expr> the expression in which to do the substitutions
- :test the test function (defaults to eql)
- :test-not the test function (sense inverted)
- :key function to apply to subtree test function expression argument (defaults to identity)
- returns the expression with substitutions
BUILD AN A-LIST FROM TWO LISTS
(pairlis <keys> <values> [<alist>])
In file common.lsp
<keys> list of association keys
<values> list of association values, same length as keys
<alist> existing association list, default NIL
- returns new association list
COPY THE TOP LEVEL OF A LIST
(copy-list <list>)
- In file common.lsp
- <list> the list
- returns a copy of the list (new cons cells in top level)
COPY AN ASSOCIATION LIST
(copy-alist <alist>)
In file common.lsp
- <alist> the association list
- returns a copy of the association list (keys and values not copies)
COPY A TREE
(copy-tree <tree>)
- In file common.lsp
- <tree> a tree structure of cons cells
- returns a copy of the tree structure
SET FUNCTIONS
(intersection <list1> <list2> &key :test :test-not :key)
(union <list1> <list2> &key :test :test-not :key)
(set-difference <list1> <list2> &key :test :test-not :key)
(set-exclusive-or <list1> <list2> &key :test :test-not :key)
(nintersection <list1> <list2> &key :test :test-not :key)
(nunion <list1> <list2> &key :test :test-not :key)
(nset-difference <list1> <list2> &key :test :test-not :key)
(nset-exclusive-or <list1> <list2> &key :test :test-not :key)
set-exclusive-or and nset-exclusive-or defined in common.lsp. nunion, nintersection, and nset-difference are aliased to their non-destructive counterparts in common.lsp.
- <list1> first list
- <list2> second list
- :test the test function (defaults to eql)
- :test-not the test function (sense inverted)
- :key function to apply to test function arguments (defaults to identity)
- returns intersection: list of all elements in both lists
union: list of all elements in either list
set-diference: list of all elements in first list but not in second list
set-exclusive-or: list of all elements in only one list
"n" versions are potentially destructive.
ADD UNIQUE TO LIST
(adjoin <expr> <list> :test :test-not :key)
- <expr> new element to add
- <list> the list
- :test the test function (defaults to eql)
- :test-not the test function <sense inverted)
- :key function to apply to test function arguments (defaults to identity)
- returns if element not in list then (cons <expr> <list>), else <list>.
XLISP-PLUS - Version 2.1g - Tom Almy
tom.almy@tek.com - 18 JUL 94
Generated with WebMaker