Over the last few months I’ve been learning Clojure. Best way to learn I find is to use what you learn for something you find useful or interesting. This morning, while browsing Hacker News, I found myself reading about Vitter’s reservoir sampling algorithm, with an example developed in Ruby.
After spending a little bit of time thinking over the reasoning for why this algo would work as claimed, I decided to give it a quick spin in Clojure. I’ve published my experiment on GitHub if you’re interested in a different take on the algo implementation, with some Incanter inspired visual confirmation of it’s claim.