XLISP > XLISP 2.0  -  Contents  -  Reference  -  Previous | Next

16  List Functions


  1. car - return the car of a list node
  2. cdr - return the cdr of a list node
  3. cxxr - all cxxr combinations
  4. cxxxr - all cxxxr combinations
  5. cxxxxr - all cxxxxr combinations
  6. first - get the first element of a list
  7. second - get the second element of a list
  8. third - get the third element of a list
  9. fourth - get the fourth element of a list
  10. rest - get the rest of the list except the first element
  11. cons - construct a new list node
  12. list - create a list of values
  13. append - append lists
  14. reverse - reverse a list
  15. last - return the last list node of a list
  16. member - find an expression in a list
  17. assoc - find an expression in an a-list
  18. remove - remove elements from a list
  19. remove-if - remove elements that pass test
  20. remove-if-not - remove elements that fail test
  21. length - find the length of a list, vector or string
  22. nth - return the nth element of a list
  23. nthcdr - return the nth cdr of a list
  24. mapc - apply function to successive cars
  25. mapcar - apply function to successive cars
  26. mapl - apply function to successive cdrs
  27. maplist - apply function to successive cdrs
  28. subst - substitute expressions
  29. sublis - substitute with an a-list

(car expr) - return the car of a list node
expr - the list node
returns - the car of the list node

(cdr expr) - return the cdr of a list node
expr - the list node
returns - the cdr of the list node

(cxxr expr) - all cxxr combinations, like caar, cadr and cdar, cddr

(cxxxr expr) - all cxxxr combinations, like caaar...caddr and cdaar...cdddr

(cxxxxr expr) - all cxxxxr combinations, like caaaar...cadddr and cdaaar...cddddr

(first expr) - get the first element of a list, a synonym for car

(second expr) - get the second element of a list, a synonym for cadr

(third expr) - get the third element of a list, a synonym for caddr

(fourth expr) - get the fourth element of a list, a synonym for cadddr

(rest expr) - get the rest of the list with the first element removed, a synonym for cdr

(cons expr1 expr2) - construct a new list node
expr1 - the car of the new list node
expr2 - the cdr of the new list node
returns - the new list node

(list expr...) - create a list of values
expr - expressions to be combined into a list
returns - the new list

(append expr...) - append lists
expr - lists whose elements are to be appended
returns - the new list

(reverse expr) - reverse a list
expr - the list to reverse
returns - a new list in the reverse order

(last list) - return the last list node of a list
list - the list
returns - the last list node in the list

(member expr list &key :test :test-not) - find an expression in a list
expr - the expression to find
list - the list to search
:test - the test function [defaults to eql]
:test-not - the test function [sense inverted]
returns - the remainder of the list starting with the expression

(assoc expr alist &key :test :test-not) - find an expression in an a-list
expr - the expression to find
alist - the association list
:test - the test function [defaults to eql]
:test-not - the test function [sense inverted]
returns - the alist entry or nil

(remove expr list &key :test :test-not) - remove elements from a list
expr - the element to remove
list - the list
:test - the test function [defaults to eql]
:test-not - the test function [sense inverted]
returns - copy of list with matching expressions removed

(remove-if test list) - remove elements that pass test
test - the test predicate
list - the list
returns - copy of list with matching elements removed

(remove-if-not test list) - remove elements that fail test
test - the test predicate
list - the list
returns - copy of list with non-matching elements removed

(length expr) - find the length of a list, vector or string
expr - the list, vector or string
returns - the length of the list, vector or string

(nth n list) - return the nth element of a 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

(nthcdr n list) - return the nth cdr of a 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

(mapc fcn list1 list...) - apply function to successive cars
fcn - the function or function name
listn - a list for each argument of the function
returns - the first list of arguments

(mapcar fcn list1 list...) - apply function to successive cars
fcn - the function or function name
listn - a list for each argument of the function
returns - a list of the values returned

(mapl fcn list1 list...) - apply function to successive cdrs
fcn - the function or function name
listn - a list for each argument of the function
returns - the first list of arguments

(maplist fcn list1 list...) - apply function to successive cdrs
fcn - the function or function name
listn - a list for each argument of the function
returns - a list of the values returned

(subst to from expr &key :test :test-not) - substitute expressions
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]
returns - the expression with substitutions

(sublis alist expr &key :test :test-not) - substitute with an a-list
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]
returns - the expression with substitutions

XLISP > XLISP 2.0  -  Contents  -  Reference  -  Previous | Next