Your last line is wrong:
[_] -> last [_::t] ;;
try to replace it with:
x :: xs -> last xs ;;
-------- Forwarded Message --------
Subject: Re: [Caml-list] what is here the syntax error
Date: Wed, 05 Nov 2014 13:14:54 +0100
From: Francois Berenger <francois.berenger@inria.fr>
To: Roelof Wobben <r.wobben@home.nl>
On 11/05/2014 12:45 PM, Roelof Wobben wrote:
Hello,
I know this question must be asked on the beginners list but I still did
not get approved after I left the list.
I try again to learn Ocaml and Im stuck at exercise 1 of the 99 ocaml
problems.
Here is my solution :
let rec last list =
match list with
[] -> None
[x] -> Some x
[_] -> last [_::t] ;;
Your last line is wrong:
[_] -> last [_::t] ;;
try to replace it with:
x :: xs -> last xs ;;
But now I see a syntax error on the [x] part.
Can anyone explain to me what I did wrong ?
Roelof
--
Regards,
Francois.
--
Caml-list mailing list. Subscription management and archives:
https://sympa.inria.fr/sympa/arc/caml-list
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs