[Haskell-cafe] First time haskell - parse error!

Colin Adams colinpauladams at googlemail.com
Wed Mar 10 06:32:04 EST 2010


On 10 March 2010 11:21, Ketil Malde <ketil at malde.org> wrote:

> [Cited from "Learn You a Haskell for Great Good"]
>
>>>     oddSquareSum :: Integer
>>>     oddSquareSum = sum . takeWhile (<10000) . filter odd . map (^2) $ [1..]
>

>
> To me, the first one is very clear, and exposes the function as what it
> is: a neat, linear pipeline of standard function applications.  You
> don't have to be a very seasoned programmer to quickly identify this
> structure, or the components involved.
>

> Named values are just like comments, which IMO also should be kept to a
> bare minimum.  A bit tongue in cheek: If you need a name to understand
> what a function does, or a comment to understand how it does it, then
> your code is too complicated.

Tongue-in-cheek? It's completely ridiculous.
That example above has six names in it. Try recursively replacing all
the names in it with their definitions, until the only names left are
built-in primitives.
-- 
Colin Adams
Preston,
Lancashire,
ENGLAND


More information about the Haskell-Cafe mailing list