score:1

Accepted answer

Sequences basically work OK at what they do, which is to provide a simple interface that yields a stream of values on demand. If you have more complicated demands then you're welcome to use a more powerful interface.

For instance, your string examples look like they could benefit being written as a parser: that is, a function that consumes a sequence of characters from a stream and uses internal state to keep track of where it is in the stream.


Related Articles