<html>
<head>
<meta content="text/html; charset=windows-1252"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div class="moz-cite-prefix">Thanks, <br>
<br>
This one is working. <br>
<br>
Now the next "problem". Look if I can make init' work.<br>
<br>
Roelof<br>
<br>
<br>
Sumit Sahrawat, Maths & Computing, IIT (BHU) schreef op
12-5-2015 om 14:39:<br>
</div>
<blockquote
cite="mid:CAJbEW8PTPjJPbyd+-0hQZLDmuSqYGvVE2a75dehRB8K2BrNwTQ@mail.gmail.com"
type="cite">
<div dir="ltr">The type of (.)
<div><br>
</div>
<div><font face="monospace, monospace"> (.) :: (b -> c)
-> (a -> b) -> a -> c</font></div>
<div><font face="monospace, monospace"><br>
</font></div>
Means that "last' [1,2,3]" should be a function, which it isn't
<div>You can instead try,</div>
<div><br>
</div>
<div><font face="monospace, monospace"> main = (print .
last') [1,2,3]</font></div>
<div><font face="monospace, monospace"><br>
</font></div>
Or equivalently,
<div><font face="monospace, monospace"><br>
</font></div>
<div><font face="monospace, monospace"> main = print . last'
$ [1,2,3]</font></div>
</div>
<div class="gmail_extra"><br>
<div class="gmail_quote">On 12 May 2015 at 18:06, Roelof Wobben
<span dir="ltr"><<a moz-do-not-send="true"
href="mailto:r.wobben@home.nl" target="_blank">r.wobben@home.nl</a>></span>
wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">
<div bgcolor="#FFFFFF" text="#000000">
<div>Thanks all. <br>
<br>
I have now this : <br>
<span class=""> <br>
-- | The main entry point.<br>
</span> last' :: [a] -> Maybe a<br>
last' [] = Nothing<br>
last' [x] = Just x <br>
last' (_:xs) = last' xs<br>
<br>
<br>
main = print . last' [1,2,3]<br>
<br>
but I see this message about main : <br>
<br>
<i> GHC threw an exception : Couldn't match expected
type ‘<a moz-do-not-send="true"
href="http://GHC.Types.IO" target="_blank">GHC.Types.IO</a>
a0’ with actual type ‘a1 -> <a
moz-do-not-send="true" href="http://GHC.Types.IO"
target="_blank">GHC.Types.IO</a> ()’ <br>
<br>
I work wih the fpcomplete and they demand a main in
the code .<br>
<br>
Roelof<br>
<br>
</i><br>
<br>
<br>
Nicolas SCHOEMAEKER schreef op 12-5-2015 om 11:45:<br>
</div>
<blockquote type="cite">
<div>
<div class="h5">
<p dir="ltr">Hi</p>
<p dir="ltr">In your definition, you seem to have
forgotten the case when your list is empty.<br>
[x] won't bind on [].</p>
<p dir="ltr">Regards,<br>
Nicolas SCHOEMAEKER</p>
<p dir="ltr">(<i>This email was composed from a
mobile phone, please</i><i> excuse</i><i> any
resulting mistakes</i>)</p>
<p dir="ltr">Web, Cloud Computing & WebRTC
developer<br>
Haskell Programmer<br>
Artificial Intelligence & Robotics enthusiast</p>
<div class="gmail_quote">On May 12, 2015, at 11:40
AM, Kim-Ee Yeoh <<a moz-do-not-send="true"
href="mailto:ky3@atamo.com" target="_blank">ky3@atamo.com</a>>
wrote:
<blockquote class="gmail_quote" style="margin:0pt
0pt 0pt 0.8ex;border-left:1px solid
rgb(204,204,204);padding-left:1ex">
<div dir="ltr">
<div class="gmail_extra"><br>
<div class="gmail_quote">On Tue, May 12,
2015 at 1:42 PM, Roelof Wobben <span
dir="ltr"><<a moz-do-not-send="true"
href="mailto:r.wobben@home.nl"
target="_blank">r.wobben@home.nl</a>></span>
wrote:<br>
<br>
<blockquote class="gmail_quote"
style="margin:0 0 0 .8ex;border-left:1px
#ccc solid;padding-left:1ex"><span> -- |
The main entry point.<br>
last' :: [a] -> a <br>
</span> last' [x] = x <br>
<span> last' (x:xs) = last xs</span></blockquote>
</div>
<br>
</div>
<div class="gmail_extra">Notice that the last
line does no recursion: it invokes the
Prelude's definition of last.<br>
</div>
<div class="gmail_extra"><br clear="all">
<div>
<div>-- Kim-Ee</div>
</div>
</div>
</div>
<pre><hr>
Beginners mailing list
<a moz-do-not-send="true" href="mailto:Beginners@haskell.org" target="_blank">Beginners@haskell.org</a>
<a moz-do-not-send="true" href="http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners</a>
</pre>
</blockquote>
</div>
<br>
<fieldset></fieldset>
<br>
</div>
</div>
<pre>_______________________________________________
Beginners mailing list
<a moz-do-not-send="true" href="mailto:Beginners@haskell.org" target="_blank">Beginners@haskell.org</a>
<a moz-do-not-send="true" href="http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners</a>
</pre>
</blockquote>
<br>
<br>
<span class=""><br>
<hr
style="border:none;color:#909090;background-color:#b0b0b0;min-height:1px;width:99%">
<table style="border-collapse:collapse;border:none">
<tbody>
<tr>
<td style="border:none;padding:0px 15px 0px 8px">
<a moz-do-not-send="true"
href="http://www.avast.com/" target="_blank">
<img moz-do-not-send="true"
src="http://static.avast.com/emails/avast-mail-stamp.png"
alt="Avast logo" border="0"> </a> </td>
<td>
<p
style="color:#3d4d5a;font-family:"Calibri","Verdana","Arial","Helvetica";font-size:12pt">
Dit e-mailbericht is gecontroleerd op virussen
met Avast antivirussoftware. <br>
<a moz-do-not-send="true"
href="http://www.avast.com/" target="_blank">www.avast.com</a>
</p>
</td>
</tr>
</tbody>
</table>
<br>
</span></div>
<br>
_______________________________________________<br>
Beginners mailing list<br>
<a moz-do-not-send="true"
href="mailto:Beginners@haskell.org">Beginners@haskell.org</a><br>
<a moz-do-not-send="true"
href="http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners"
target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners</a><br>
<br>
</blockquote>
</div>
<br>
<br clear="all">
<div><br>
</div>
-- <br>
<div class="gmail_signature">
<div dir="ltr">
<div>
<div dir="ltr">
<div dir="ltr">
<div>Regards</div>
<div dir="ltr">
<div><br>
</div>
<div>Sumit Sahrawat</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
Beginners mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Beginners@haskell.org">Beginners@haskell.org</a>
<a class="moz-txt-link-freetext" href="http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners">http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners</a>
</pre>
</blockquote>
<br>
<br /><br />
<hr style='border:none; color:#909090; background-color:#B0B0B0; height: 1px; width: 99%;' />
<table style='border-collapse:collapse;border:none;'>
<tr>
<td style='border:none;padding:0px 15px 0px 8px'>
<a href="http://www.avast.com/">
<img border=0 src="http://static.avast.com/emails/avast-mail-stamp.png" alt="Avast logo" />
</a>
</td>
<td>
<p style='color:#3d4d5a; font-family:"Calibri","Verdana","Arial","Helvetica"; font-size:12pt;'>
Dit e-mailbericht is gecontroleerd op virussen met Avast antivirussoftware.
<br><a href="http://www.avast.com/">www.avast.com</a>
</p>
</td>
</tr>
</table>
<br />
</body>
</html>