Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- let calculateSeries = function
- | [] -> []
- | x :: xs ->
- let length, _, lastSeriesLength, otherSeries =
- List.fold (fun (i, thisSeriesValue, thisSeriesLength, otherSeries) x ->
- if x = thisSeriesValue then
- i+1, thisSeriesValue, thisSeriesLength+1, otherSeries
- else
- i+1, x, 1, (i - thisSeriesLength + 1, thisSeriesLength) :: otherSeries
- ) (0, x, 1, []) xs
- (length - lastSeriesLength + 1, lastSeriesLength) :: otherSeries
- |> List.rev
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement