Splitting a sequence using a binary predicate on adjacent elements

Nordlöw per.nordlow at gmail.com
Tue Oct 17 13:09:18 UTC 2017


I can't find any algorithm/range in Phobos that can be used to 
split (eagerly or lazily) a sequence using a binary predicate on 
adjacent elements as follows

[1,2,3,5,10,11,12,13,20,21,100].splitBy!"a + 1 != b"()

should evaluate to

[[1,2,3], [5], [10,11,12,13], [20,21], [100]]

.

Is there one?


More information about the Digitalmars-d-learn mailing list