remove

Removes an element from a sequence.

Returns a sequence consisting of the elements of source-sequence not equal to value.  The result-sequence may or may not be freshly allocated.  However, the source-sequence is never modified by remove.

test is a function that determines whether an element is equal to value.  The test function may be non-commutative: it is always called with an element from source-sequence as its first argument and value as its second argument.

If count is #f, then all copies of value are removed.  Otherwise, no more than count copies of value are removed (so additional elements equal to value might remain in result-sequence).

define variable *old-list* = list(1, 2, 3)
define variable *new-list* = remove(*old-list*, 1)
*new-list*
⇒ #(2, 3)
*new-list* == tail(*old-list*)
⇒ {undefined}

Exported from

Modifiers

open

Arguments

source-sequenceAn instance of <sequence>.
valueAn instance of <object>.
test:An instance of <function>.  The default is ==.
count:An instance of <integer> or #f.  The default is #f.

Values

result-sequenceAn instance of <sequence>.
Removes an element from a sequence.
The common-dylan module.
Whenever possible, we have tried to keep the Dylan module pristine and unextended, preferring to add our extensions to separate modules or libraries.
The class of collections whose keys are consecutive integers starting from zero.
The class of all Dylan objects.
The class of objects that can be applied to arguments.
Compares two objects for identity.
The class of integers.