On 1/22/21 2:56 PM, H. S. Teoh wrote:
On Friday, 22 January 2021 at 17:29:08 UTC, Steven Schveighoffer wrote:
On 1/22/21 11:57 AM, Jon Degenhardt wrote:
[...]
Another way to look at it: If split (eager) took a predicate, that
'xyz.splitter(args).back' and 'xyz.split(args).back' should produce
the same result. But they will not with the example given.
With what example given? The example you gave is incomplete (what are
args?)
[...]
Here is a case for which iterating forwards yields a different sequence
from iterating backwards (if we were to allow the latter):
"bbcbcba".splitter("bcb")
Iterating forwards gives us the subranges: "b", "cba".
Iterating backwards gives us: "a", "bbc".
So it cannot be a bidirectional range, at least not in the expected sense
that iterating from the back ought to give us the same subranges as
iterating from the front, only in a reverse order. Here iterating
backwards yields a completely different decomposition.
Yes thank you! That makes sense, and I wasn't thinking of that.
I still believe that any splitter based on individual elements should be
bidirectional.
-Steve