Forall - Function SummarySummary:Evaluates a block for every value in a series. Usage:forall word body Arguments:word - Word set to each position in series and changed as a result (must be: word) body - Block to evaluate each time (must be: block) Description:The FORALL function moves through a series one value at a time. The WORD argument is a variable that moves through the series. Prior to evaluation, the WORD argument must be set to the desired starting position within the series (normally the head, but any position is valid). After each evaluation of the block, the word will be advanced to the next position within the series.
Important: The WORD argument is modified as a result of running this function. The WORD is set to the tail of the series in most cases. You can reset it to the head of the series with a HEAD function. For example:
Now, reset the chars word to the head of the string:
The FORALL function can be thought of as a shortcut for:
Related:for - Repeats a block over a range of values.
| |||||
|