caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Francois Berenger <francois.berenger@inria.fr>
To: "caml >> OCaml List" <caml-list@inria.fr>
Subject: Re: [Caml-list] what is here the syntax error
Date: Wed, 05 Nov 2014 13:15:17 +0100	[thread overview]
Message-ID: <545A14D5.1090907@inria.fr> (raw)
In-Reply-To: <545A14BE.5080308@inria.fr>




-------- 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.



       reply	other threads:[~2014-11-05 12:15 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <545A14BE.5080308@inria.fr>
2014-11-05 12:15 ` Francois Berenger [this message]
2014-11-05 12:24   ` Pierrick Couderc
2014-11-05 11:45 Roelof Wobben

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=545A14D5.1090907@inria.fr \
    --to=francois.berenger@inria.fr \
    --cc=caml-list@inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).