Whenever I&#39;m looking for a bug in Haskell code, I find it helpful to start by seeing if I can simplify the code any first. In this case, there are a couple of things I notice:<br><ul><li>validPointsOf is just a filter. It would be easier to write &quot;valid :: MyDirection -&gt; Bool&quot; and then &quot;validPointsOf = filter (valid . snd)&quot;</li>
<li>Similarly, there&#39;s no need to write your own minimum-finder and call it lowestY. Instead, write (or derive!) an Ord instance, and then use the standard prelude function &quot;minimum&quot;</li><li>a small simplification of sortByCoTan: sortByCoTan pivot = sortBy (comparing (coTan pivot))</li>
</ul>Hope this helps!<br><br><div class="gmail_quote">2009/3/5 Rob Crowther <span dir="ltr">&lt;<a href="mailto:weilawei@gmail.com">weilawei@gmail.com</a>&gt;</span><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<p>I wrote a &quot;solution&quot; to this problem, but it appears to return incorrect results. There&#39;s a pastebin of the code at <a href="http://hpaste.org/fastcgi/hpaste.fcgi/view?id=2121" target="_blank">http://hpaste.org/fastcgi/hpaste.fcgi/view?id=2121</a> and a picture of the inputs, outputs, and expected results graphed at <a href="http://img510.imageshack.us/img510/9971/resultsg.jpg" target="_blank">http://img510.imageshack.us/img510/9971/resultsg.jpg</a><br clear="all">

</p><p>I&#39;m wondering if this is a flaw in my code, my understanding of the problem, or both. Any ideas on how to track this one down would be very much appreciated.</p><p>Thank you!</p><br><font color="#888888">-- <br>
ヽ(^o^)ノ &nbsp;-rob<br>
</font><br>_______________________________________________<br>
Haskell-Cafe mailing list<br>
<a href="mailto:Haskell-Cafe@haskell.org">Haskell-Cafe@haskell.org</a><br>
<a href="http://www.haskell.org/mailman/listinfo/haskell-cafe" target="_blank">http://www.haskell.org/mailman/listinfo/haskell-cafe</a><br>
<br></blockquote></div><br>