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

17  Destructive List Functions


  1. rplaca - replace the car of a list node
  2. rplacd - replace the cdr of a list node
  3. nconc - destructively concatenate lists
  4. delete - delete elements from a list
  5. delete-if - delete elements that pass test
  6. delete-if-not - delete elements that fail test
  7. sort - sort a list

(rplaca list expr) - replace the car of a list node
list - the list node
expr - the new value for the car of the list node
returns - the list node after updating the car

(rplacd list expr) - replace the cdr of a list node
list - the list node
expr - the new value for the cdr of the list node
returns - the list node after updating the cdr

(nconc list...) - destructively concatenate lists
list - lists to concatenate
returns - the result of concatenating the lists

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

(delete-if test list) - delete elements that pass test
test - the test predicate
list - the list
returns - the list with matching elements deleted

(delete-if-not test list) - delete elements that fail test
test - the test predicate
list - the list
returns - the list with non-matching elements deleted

(sort list test) - sort a list
list - the list to sort
test - the comparison function
returns - the sorted list

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