remove
remove — removes list items without altering the list.
Syntax
remove (s_exp, list, use_equal?)
Arguments
- s_exp
- An expression to remove from the
list.
- list
- The list from which to remove the
s_exp.
- use_equal
- An optional argument. If t,
remove uses the
equal function for equality, otherwise it
uses the more stringent
eq.
Returns
The list, with any matching
s_exp removed.
Description
This function non-destructively walks a list and removes
elements matching the passed s_exp
using either eq or equal.
Example
Gamma> A = list (#a, #b, #c, #b, #a);
(a b c b a)
Gamma> remove (#a, A);
(b c b)
Gamma> A;
(a b c b a)
Gamma> B = list(1,2,3,2,1);
(1 2 3 2 1)
Gamma> remove(2,B);
(1 2 3 2 1)
Gamma> remove(2,B,t);
(1 3 1)
Gamma>