Exercise: Sieve of Eratosthenes
eratosthenes ruby programmingAfter reading an interesting blog post from Robert Martin I started writing this nice algorithm in Ruby (I'm still learning it).
As I'm a refactoring freak, here's the first version:
Nasty right? Then the cleaned up release:
As I'm a refactoring freak, here's the first version:
Nasty right? Then the cleaned up release: