From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id KAA04463; Mon, 16 Dec 2002 10:25:12 +0100 (MET) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id KAA04454 for ; Mon, 16 Dec 2002 10:25:10 +0100 (MET) Received: from mailhost.tni.fr (firewall.tni.fr [195.25.255.61]) by concorde.inria.fr (8.11.1/8.11.1) with ESMTP id gBG9P9918005 for ; Mon, 16 Dec 2002 10:25:09 +0100 (MET) Received: from groscool.tni.fr ([195.25.255.1]) by mailhost.tni.fr (Netscape Messaging Server 3.62) with SMTP id 2281; Mon, 16 Dec 2002 10:25:05 +0100 Received: from 192.168.7.60 by groscool.tni.fr (InterScan E-Mail VirusWall NT); Mon, 16 Dec 2002 10:25:04 +0100 (Paris, Madrid) Message-ID: <3DFD9BB7.34E90061@tni.fr> Date: Mon, 16 Dec 2002 10:24:07 +0100 From: "sebastien FURIC" X-Mailer: Mozilla 4.78 [fr] (Windows NT 5.0; U) X-Accept-Language: fr MIME-Version: 1.0 To: benecke@iws.cs.uni-magdeburg.de, caml-list@inria.fr CC: Sven Luther Subject: [Caml-list] Re: A similar small problem References: <200212160855.gBG8tvL14522@iws.cs.uni-magdeburg.de> Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk Klaus Benecke a écrit : > > Thank you very much for your comments, > I installed OCAML 3.01 and the mentioned problems disappeared, > but a similar problem remains: > > let rec inclu_l=fun > [] l -> true > | (n::ns) l -> mem n l & inclu_l ns l;; > > File "C:/OTTO/CAMLquellen/XML2002/test.ml", line 3, characters > 1-2: > Syntax error > Can you help me once more? > Mit freundlichen Gruessen > Klaus Benecke > e-mail: benecke@iws.cs.uni-magdeburg.de > home-page: http://theo.cs.uni-magdeburg.de/benecke.html "fun patt1 patt2 ... pattn ->" could be view as a macro for: "function patt1 -> function patt2 -> ... function pattn ->" so your program is not syntactically valid. You have to use "match ... with" if you want to match against more than one pattern: let rec inclu_l ns l = match ns, l with | [], _ -> true | n :: ns', _ -> mem n l && inclu_l l ns' However, since you don't have to match "l" against anything (hence wildcards), you can simply write: let rec inclu_l ns l = match ns with | [] -> true | n :: ns' -> mem n l && inclu_l l ns' Or, (syntactically) better: let rec inclu_l l = function | [] -> true | n :: ns -> mem n l && inclu_l l ns by exanching "l" with the matched list (arguments that do not need to be matched are often placed at first positions). Cheers, Sebastien. ------------------- To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ Beginner's list: http://groups.yahoo.com/group/ocaml_beginners