On Sun, Nov 8, 2009 at 9:04 PM, michael rice <nowg...@yahoo.com> wrote:

> Of course! Back to the drawing board.
>
>
If I understand the problem correctly, I'm not convinced that foldl is the
right approach (nevermind that foldl is almost never what you want, foldl'
and foldr being the correct choice almost always). My proposition would be
the following :

> area ps = abs . (/2) . sum $ zipWith (\(x,y) (x',y') -> (x - x') * (y +
y')) ps (tail $ cycle ps)

I think it express the algorithm more clearly.

-- 
Jedaï
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to