Sequence may represent many kinds of sequential elements: natural numbers, word from a source text, hues in a color wheel, bytes in a memory allocation, and so forth. It is natural and common to stride through sequences, especially those that aren’t necessarily numerical in nature. A stride allows you to collect or consume spaced-out values at a faster pace. For example, you might want to look at “every 4th byte” to process alpha channels, “every other row” for spreadsheet highlights, or “every two hundredth word” for frequency analysis.
stride functions are number based. They are useful for striding through integer and floating point numbers. They can act as integer-based collection indices. These functions aren’t, however, suitable for skipping through non-numerical, possibly infinite sequences, which may or may not be multipass or otherwise indexable.
For example, you might create a color progression
Sequenceand parameterize how quickly to procede from, for example, red through orange, yellow, green, and beyond.
You cannot use indexing features without creating an intermediate array.
This proposal extends
Sequence to introduce strides across any base.
gist with proposal details: https://gist.github.com/erica/3cd7c35cbb360eab02a7e2f89326ce9e