[Haskell-begin] Re: For starters...

Rafael Gustavo da Cunha Pereira Pinto rafaelgcpp at gmail.com
Thu Jul 17 12:14:55 EDT 2008


Is there any good tutorial on arrows?

Thanks

On Thu, Jul 17, 2008 at 13:08, Rafael Gustavo da Cunha Pereira Pinto <
rafaelgcpp at gmail.com> wrote:

> I will use foldr max 0, because I want 0 for the empty list.
>
>
>
>
> On Thu, Jul 17, 2008 at 12:09, Isaac Dupree <isaacdupree at charter.net>
> wrote:
>
>> Marco Túlio Gontijo e Silva wrote:
>>
>>> Hi.
>>>
>>> Em Qui, 2008-07-17 às 11:42 -0300, Felipe Lessa escreveu:
>>>
>>>> f = sum &&& foldr max 0 >>> uncurry (-)
>>>>
>>>
>>> You can replace
>>>
>>>> foldr max 0
>>>>
>>> with simply
>>>
>>>> foldr1 max
>>>>
>>> or even
>>>
>>>> maximum
>>>>
>>>
>> If it's important that the function return 0 when given an empty list,
>> then you don't want to use foldr1 or maximum.  But, if you don't need it to,
>> then it may be sounder to have it fail on an empty list, because it's not
>> particularly well-defined what it should return then.
>>
>> -Isaac
>>
>> _______________________________________________
>> Beginners mailing list
>> Beginners at haskell.org
>> http://www.haskell.org/mailman/listinfo/beginners
>>
>
>
>
> --
> Rafael Gustavo da Cunha Pereira Pinto
> Electronic Engineer, MSc.
>



-- 
Rafael Gustavo da Cunha Pereira Pinto
Electronic Engineer, MSc.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/beginners/attachments/20080717/efaaedc4/attachment.htm


More information about the Beginners mailing list