Skip to content

Instantly share code, notes, and snippets.

@hodzanassredin
Created September 6, 2012 10:53
Show Gist options
  • Save hodzanassredin/3654744 to your computer and use it in GitHub Desktop.
Save hodzanassredin/3654744 to your computer and use it in GitHub Desktop.
hw to split seq by date
windowBySecond (tweetsSq: seq<Tweet>) =
let tweet = Seq.head tweetsSq
let currSec = (toDateTime tweet.DateStr).Second
let tweetsForSecond = Seq.takeWhile (fun elem -> (toDateTime elem.DateStr).Second = currSec) tweetsSq |> Seq.toList
Some(Some(tweetsForSecond.Length), tweetsSq)
let tweetsPerMSecond tracking =
//|> Seq.map (fun t -> (toDateTime t.DateStr))
Seq.unfold (fun state -> windowBySecond state) (tweets tracking)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment