<div class="gmail_quote">On Sun, Nov 8, 2009 at 9:04 PM, michael rice <span dir="ltr">&lt;<a href="mailto:nowgate@yahoo.com">nowgate@yahoo.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<table border="0" cellpadding="0" cellspacing="0"><tbody><tr><td style="font-family: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; font-size: inherit; line-height: inherit; font-size-adjust: inherit; font-stretch: inherit;" valign="top">
Of course! Back to the drawing board.<br><br></td></tr></tbody></table></blockquote></div><br>If I understand the problem correctly, I&#39;m not convinced that foldl is the right approach (nevermind that foldl is almost never what you want, foldl&#39; and foldr being the correct choice almost always). My proposition would be the following :<br>
<br>&gt; area ps = abs . (/2) . sum $ zipWith (\(x,y) (x&#39;,y&#39;) -&gt; (x - x&#39;) * (y + y&#39;)) ps (tail $ cycle ps)<br><br>I think it express the algorithm more clearly.<br><br>-- <br>Jedaï<br>