The 'remove' function searches through 'list-expr' for 'expr'. If 'expr' is found, 'remove' returns the list with the 'expr' deleted. All occurances of 'expr' are deleted. If 'expr' is not found, then the 'list-expr' is returned unaltered. You may specify your own test with the ':test' and ':test-not' keywords followed by the test you which to perform. Note that this operation is non-destructive, it does not modify or affect 'list-expr' directly, it creates a modified copy.
(setq mylist '(a b c d it e f)) ; set up a list (remove 'it mylist) ; returns (A B C D E F) (print mylist) ; prints (A B C D IT E F) ; note that MYLIST is not affected (setq mylist '(a b c b d b)) ; change list to include duplicates (remove 'b mylist) ; returns (A C D) (setq alist '( (a) (b) (it) (c))) ; set up another list (remove '(it) alist) ; returns ((A) (B) (IT) (C)) ; the EQ test doesn't work for lists (remove '(it) alist :test 'equal) ; returns ((A) (B) (C)) (setq slist '( "a" "b" "it" "c")) ; set up yet another list (remove "it" slist) ; returns ("a" "b" "c") (remove "it" slist :test-not 'equal) ; returns ("it") ; REMOVE takes away everything but IT
Note: The 'remove' function can work with a list or string as the 'expr'. However, the default eql test does not work with lists or strings, only symbols and numbers. To make this work, you need to use the ':test' keyword along with equal for 'test'.
Common Lisp: XLISP does not support the ':from-end', ':start', ':end', ':count' and ':key' keywords which Common Lisp does.
function in the