From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@sympa.inria.fr Delivered-To: caml-list@sympa.inria.fr Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by sympa.inria.fr (Postfix) with ESMTPS id 2776D7FADB for ; Wed, 5 Nov 2014 13:15:17 +0100 (CET) X-IronPort-AV: E=Sophos;i="5.07,319,1413237600"; d="scan'208";a="104933303" Received: from meleze.ens.fr (HELO [129.199.99.114]) ([129.199.99.114]) by mail2-relais-roc.national.inria.fr with ESMTP/TLS/DHE-RSA-AES128-SHA; 05 Nov 2014 13:15:16 +0100 Message-ID: <545A14D5.1090907@inria.fr> Date: Wed, 05 Nov 2014 13:15:17 +0100 From: Francois Berenger User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.2.0 MIME-Version: 1.0 To: "caml >> OCaml List" References: <545A14BE.5080308@inria.fr> In-Reply-To: <545A14BE.5080308@inria.fr> X-Forwarded-Message-Id: <545A14BE.5080308@inria.fr> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Caml-list] what is here the syntax error -------- Forwarded Message -------- Subject: Re: [Caml-list] what is here the syntax error Date: Wed, 05 Nov 2014 13:14:54 +0100 From: Francois Berenger To: Roelof Wobben 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.