[Haskell-beginners] why is this type wrong
Nicolas SCHOEMAEKER
ns.schoe at gmail.com
Tue May 12 09:45:01 UTC 2015
Hi
In your definition, you seem to have forgotten the case when your list is empty.
[x] won't bind on [].
Regards,
Nicolas SCHOEMAEKER
(This email was composed from a mobile phone, please excuse any resulting mistakes)
Web, Cloud Computing & WebRTC developer
Haskell Programmer
Artificial Intelligence & Robotics enthusiast
On May 12, 2015, 11:40 AM, at 11:40 AM, Kim-Ee Yeoh <ky3 at atamo.com> wrote:
>On Tue, May 12, 2015 at 1:42 PM, Roelof Wobben <r.wobben at home.nl>
>wrote:
>
>-- | The main entry point.
>> last' :: [a] -> a
>> last' [x] = x
>> last' (x:xs) = last xs
>
>
>Notice that the last line does no recursion: it invokes the Prelude's
>definition of last.
>
>-- Kim-Ee
>
>
>------------------------------------------------------------------------
>
>_______________________________________________
>Beginners mailing list
>Beginners at haskell.org
>http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/beginners/attachments/20150512/3d2b8420/attachment-0001.html>
More information about the Beginners
mailing list