type: function (subr) location: built-in source file: xllist.c Common LISP compatible: similar supported on: all machines
(delete-if-not <test> <list> ) <test> - the test function to be performed <list> - the list to delete from
DELETE-IF-NOT destructively modifies the <list> by removing the elements of the <list> that fail the <test>. The destructive aspect of this operation means that the actual symbol value is used in the list-modifying operations - not a copy. <list> must evaluate to a valid list. An atom for <list> will result in an error. Having NIL for <list> will return a NIL as the result.
(setq mylist '(1 2 3 4 5 6 7 8)) ; set up a list (delete-if-not 'oddp mylist) ; returns (1 3 5 7) (print mylist) ; prints (1 3 5 7) ; note that MYLIST is affected (setq mylist '(a nil b nil c)) ; set up a list (delete-if-not 'null mylist) ; returns (NIL NIL)
BUG: DELETE-IF-NOT will return the proper value, but it does not always properly modify the symbol containing the value. This seems to be true if the first element of the <list> fails the test (and should be deleted).
COMMON LISP COMPATIBILITY: XLISP does not support the :FROM-END, :START, :END, :COUNT and :KEY keywords which Common LISP does.