Split seq in F#

Viewed 2955

I should split seq<a> into seq<seq<a>> by an attribute of the elements. If this attribute equals by a given value it must be 'splitted' at that point. How can I do that in FSharp?

It should be nice to pass a 'function' to it that returns a bool if must be splitted at that item or no.

Sample: Input sequence: seq: {1,2,3,4,1,5,6,7,1,9} It should be splitted at every items when it equals 1, so the result should be:

seq
{
seq{1,2,3,4}
seq{1,5,6,7}
seq{1,9}
}
5 Answers
Related