<div dir="ltr">Is there any good tutorial on arrows?<br><br>Thanks<br><br><div class="gmail_quote">On Thu, Jul 17, 2008 at 13:08, Rafael Gustavo da Cunha Pereira Pinto &lt;<a href="mailto:rafaelgcpp@gmail.com">rafaelgcpp@gmail.com</a>&gt; wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div dir="ltr">I will use foldr max 0, because I want 0 for the empty list.<div><div></div><div class="Wj3C7c">
<br><br><br><br><div class="gmail_quote">On Thu, Jul 17, 2008 at 12:09, Isaac Dupree &lt;<a href="mailto:isaacdupree@charter.net" target="_blank">isaacdupree@charter.net</a>&gt; wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div>Marco Túlio Gontijo e Silva wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi.<br>
<br>
Em Qui, 2008-07-17 às 11:42 -0300, Felipe Lessa escreveu:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
f = sum &amp;&amp;&amp; foldr max 0 &gt;&gt;&gt; uncurry (-)<br>
</blockquote>
<br>
You can replace<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
foldr max 0<br>
</blockquote>
with simply<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
foldr1 max<br>
</blockquote>
or even<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
maximum<br>
</blockquote></blockquote>
<br></div>
If it&#39;s important that the function return 0 when given an empty list, then you don&#39;t want to use foldr1 or maximum. &nbsp;But, if you don&#39;t need it to, then it may be sounder to have it fail on an empty list, because it&#39;s not particularly well-defined what it should return then.<br>

<font color="#888888">
<br>
-Isaac</font><div><div></div><div><br>
_______________________________________________<br>
Beginners mailing list<br>
<a href="mailto:Beginners@haskell.org" target="_blank">Beginners@haskell.org</a><br>
<a href="http://www.haskell.org/mailman/listinfo/beginners" target="_blank">http://www.haskell.org/mailman/listinfo/beginners</a><br>
</div></div></blockquote></div><br><br clear="all"><br></div></div>-- <br><div class="Ih2E3d">Rafael Gustavo da Cunha Pereira Pinto<br></div>Electronic Engineer, MSc.
</div>
</blockquote></div><br><br clear="all"><br>-- <br>Rafael Gustavo da Cunha Pereira Pinto<br>Electronic Engineer, MSc.
</div>