[Haskell-beginners] Are these soloutions all valid and a good use of Haskell

Julian Birch julian.birch at gmail.com
Tue Nov 11 08:35:13 UTC 2014


_ just means "ignore this parameter, I'm not going to use it"

On Tuesday, November 11, 2014, Roelof Wobben <r.wobben at home.nl> wrote:

>  Thanks, this is working well.
>
> But just for understanding
>
> in the part acc x Nothing   x is the input string,
> and in the part _j means the same as (xs:x)
>
> Roelof
>
>
>
> Alex Hammel schreef op 10-11-2014 22:47:
>
> It's an indentation issue. Make sure that there are no spaces before the
> bit about 'last5 = foldr acc' etc.
>
> On Mon, Nov 10, 2014 at 12:48 PM, Roelof Wobben <r.wobben at home.nl
> <javascript:_e(%7B%7D,'cvml','r.wobben at home.nl');>> wrote:
>
>> Roelof Wobben schreef op 10-11-2014 20:59:
>>
>>> last5 :: [a] -> Maybe a
>>>    last5 = foldr acc Nothing where
>>>        acc x Nothing  = Just x
>>>        acc _ j        = j
>>>
>>
>>  When I enter this in GHCI  I see this error :
>>
>> Illegal type signature: ‘[a] -> Maybe a last5’
>>
>>
>>
>>
>> _______________________________________________
>> Beginners mailing list
>> Beginners at haskell.org
>> <javascript:_e(%7B%7D,'cvml','Beginners at haskell.org');>
>> http://www.haskell.org/mailman/listinfo/beginners
>>
>
>
>
> _______________________________________________
> Beginners mailing listBeginners at haskell.org <javascript:_e(%7B%7D,'cvml','Beginners at haskell.org');>http://www.haskell.org/mailman/listinfo/beginners
>
>
>

-- 
Sent from an iPhone, please excuse brevity and typos.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/beginners/attachments/20141111/bb3c67c6/attachment-0001.html>


More information about the Beginners mailing list