One of the better Haskell tutorial has a section on list comprehension and starts out beautifully

A basic comprehension for a set that contains the first ten even natural numbers is

The part before the pipe(|) is called the output function, x is the variable, N is the input set and x <= 10 is the predicate. That means that the set contains the doubles of all natural numbers that satisfy the predicate.

All the warts of c/java start to fall off. Heck this is easier than struggling with list comprehension notation across python. The need for lazy evaluation falls in right place.

It is just natural. And it hurts to think that we “forgot” this way of thinking and its succinct expressiveness in process of learning imperative “thinking”. Brevity is distributed unevenly. I seem to be on the wrong side😦.

Python –

[i for i in range(6,40) if i % 2 == 0]

Haskell –

[a | a <- [1,2,3,5,7,8,9,12,3,23,11,7,2], a > 10]

(it is more closer to original notation, isn’t it?)

2. Anonymous functions are neatly declared

(\acc -> acc + 1) 7

would return 8 on the ghc interpreter prompt

\pattern -> body

Update :

Some of Simon Peyton Jone’s videos (Simon is the teacher we did not have ::) – Erik Meijer too is pretty infectious and can be found on channel 9, you tube.