C10 - initial
|Type||Corrade progressive sift|
each sift will return a strided list given a supplied number.
| ||an integer||return a strided list with the given stride number||
The following sift when added to a command will return each second element in the list starting and including the first zero-indexed element:
"sift", wasListToCSV([ "each", 2 ]),
Given the input
the expected output is:
eachsift will return the subset where represents the length of the list , are indices of the list and is the stride. This may seem counter-intuitive for non-programmers since the selection is expected to start from ignoring indices that conventionally start at . That is, the selection formula for the subset is expected to be . In case the latter behaviour is desired, then an additional
skipsift can be used to offset the start of the list such that the selection formula for the subset becomes .
For example, suppose that each second element in a list would have to be selected without accounting for zero-based indexed arrays or lists, then the sift would be:
"sift", wasListToCSV([ "skip", 1, "each", 2 ]),
similarly, for each third element in a list:
"sift", wasListToCSV([ "skip", 2, "each", 3 ]),