replace-elements!

Replaces those elements of mutable-collection for which predicate returns true.  The elements are replaced with the value of calling new-value-fn on the existing element.  If count is #f, all of the matching elements are replaced.  Otherwise, no more than count elements are replaced.

mutable-collection may be modified by this operation.

define variable numbers = list (10, 13, 16, 19)
replace-elements! (numbers, odd?, double)
⇒ #(10, 26, 16, 38)

Exported from

Modifiers

open

Arguments

mutable-collectionAn instance of <mutable-collection>.
predicateAn instance of <function>.
new-value-fnAn instance of <function>.
count:An instance of <integer> or #f.  The default is #f.

Values

mutable-collectionAn instance of <mutable-collection>.
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 that may be modified.
The class of objects that can be applied to arguments.
The class of integers.