Description |
FIND-ALL has a set of arguments and behavior that matches the FORALL and FORSKIP family, but for some reason binds its body argument when it doesn't have to. As with FORALL, the word that you are using is already assigned the series, and so doesn't need to be localized. The current COPY/deep of the code block is unnecessary overhead, and the unusable words (particularly 'value) don't help either.
The example source below should work better, have less overhead, be able to handle all argument words, and is more FORALL-like. It is still affected by #539 though. This source also fixes #1739.
|
Example code |
find-all: funct [
"Find all occurances of the value within the series (allows modification)."
'series [word!] "Variable for block, string, or other series"
value
body [block!] "Evaluated for each occurance"
][
assert [series? orig: get series]
while [any [set series find get series :value (set series orig false)]] [
do body
++ (series)
]
]
|