The 'remove-if-not' function searches through 'list-expr' and removes any elements that fail the 'test'. Note that this operation is non-destructive, it does not modify or affect 'list-expr' directly, it creates a modified copy.
(setq mylist '(1 2 3 4 5 6 7 8)) ; set up a list (remove-if-not 'oddp mylist) ; returns (1 3 5 7) (remove-if-not 'evenp mylist) ; returns (2 4 6 8) (print mylist) ; prints (1 2 3 4 5 6 7 8) ; note that MYLIST is not affected (setq mylist '(a nil b nil c)) ; set up a list (remove-if-not 'null mylist) ; returns (NIL NIL)
Common Lisp: XLISP does not support the ':from-end', ':start', ':end', ':count' and ':key' keywords which Common Lisp does.
See the
remove-if-not
function in the