Archive for April, 2010

Low Man’s Lyric


He walked barefoot
and seemed exhausted.
Apparently lost.
And lost He was. In his thoughts.

He tried to remember something.
Tried so hard it hurt.
Visibly so as his eyes showed.


More Haskell…


So today, I was pondering How difficult it’d be to implement the Sieve of Eratosthenes in Haskell.

Turns out, very easy after all.. and more elegant.

sieve [] = []
sieve (x:xs) = x : sieve [p | p <- xs, p `mod` x /= 0]

So With that figured out, A new challenge was to solve this for any n. O’course, my earlier much simpler solution would have sufficed –

foldl (lcm) 1 [1..20]

But that doesn’t quite use my own implementation of the Sieve of Eratosthenes algorithm, does it?

So that needed to be corrected 😉

So here’s my solution –


Go to Top