Advertisement
Guest User

Untitled

a guest
Aug 2nd, 2014
223
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
F# 0.52 KB | None | 0 0
  1.     let calculateSeries data =
  2.         let rec traverseData data origin start count = seq {
  3.             match data with
  4.             | [] -> yield (start, count)
  5.             | h::t ->
  6.                 if origin = h then
  7.                     yield! traverseData t origin start (count + 1)
  8.                 else
  9.                     yield (start, count)
  10.                     yield! traverseData t h (start + count) 1
  11.         }
  12.  
  13.         match data with
  14.         | [] -> []
  15.         | h::t -> traverseData data h 0 0 |> List.ofSeq
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement