# Da Vini Code

Simplicity is the ultimate sophistication. – Leonardo Da Vinci.

I am Vini. I like to code. Hence the title.
I love my work. And hence the blog.
I make mistakes. Hence the rotten tomatoes. (!) Er.. Just hope I don’t get that as often.

0

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 –

## For the love of Haskell…

0

Haskell never fails to impress even the mediocre programmer in me.
Here’s something I have attempted solving using Haskell.

Problem –
Find the sum of all the even-valued terms in the Fibonacci sequence which do not exceed four million.
(Source: Project Euler problem 2)
(more…)

## Look mom.. My first Haskell code

0

These days I am trying my hardest to learn Haskell.
Found these 2 great online resources Real World Haskell and Learn You a Haskell.

An attempt to solve a rather simple problem from codechef took me close to 2 days.
Not due to the lack of looping constructs..
Nor because I cannot think recursively.
But primarily due to the fact that Haskell doesn’t make it easy to mix pure and impure code.
It took me quite a while to understand that a little monadic constructs such as mapM, forM exists. And the let bindings for sprinkling pure code in between impure code.

## </2008> <2009>

3

First things first, Happy new year one and all.

It’d be almost sinful if a programming blog doesn’t start with a “Hello World!”.
Oh That’s but a cliche, right?
Wrong.
Not if you use exotic languages, I say.
How about a “Hello World!” in one of the smallest Turing complete language, Brainfuck?

Go to Top