[Haskell-beginners] Points-free style

Alexander Shendi Alexander.Shendi at bawue.de
Sun Jun 5 17:09:17 CEST 2011


Hi folks,

I am working my way through "Learn You a Haskell for Great Good" and
have reached page 84, where the book recommends that you define your
functions in a "points-free style", using the "." and "$" operators.

Now I have:

sumProducts' :: Num a => [a] -> [a] -> a
sumProducts' x y = sum (zipWith (*) x y)

I would like to eliminate the "x" and the "y" in the definition, but all
I have managed to contrive is:

sumProducts :: Num a => [a] -> [a] -> a
sumProducts x = sum . zipWith (*) x

How do I proceed from here? Any advice is welcome :)

Many thanks in advance,

/Alexander




More information about the Beginners mailing list