From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from discorde.inria.fr (discorde.inria.fr [192.93.2.38]) by yquem.inria.fr (Postfix) with ESMTP id 827F7BC69 for ; Mon, 13 Nov 2006 13:16:49 +0100 (CET) Received: from smtphost.cis.strath.ac.uk (smtphost.cis.strath.ac.uk [130.159.196.96]) by discorde.inria.fr (8.13.6/8.13.6) with ESMTP id kADCGmqt002528 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL) for ; Mon, 13 Nov 2006 13:16:49 +0100 Received: from [130.159.193.241] (wireless-241.cis.strath.ac.uk [130.159.193.241]) by smtphost.cis.strath.ac.uk (8.13.4/8.13.3/Debian-6) with ESMTP id kADCGOUH000427 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Mon, 13 Nov 2006 12:16:25 GMT Message-ID: <45586212.1070206@cis.strath.ac.uk> Date: Mon, 13 Nov 2006 12:16:18 +0000 From: Peter Gregory User-Agent: Thunderbird 1.5.0.8 (Windows/20061025) MIME-Version: 1.0 To: colonna@ccr.jussieu.fr Cc: caml-list@yquem.inria.fr Subject: Re: [Caml-list] using a wiki to answer low level language questions References: <45585D13.5050401@ccr.jussieu.fr> In-Reply-To: <45585D13.5050401@ccr.jussieu.fr> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit X-CIS-MailScanner: Found to be clean X-CIS-MailScanner-SpamCheck: not spam (whitelisted), SpamAssassin (score=0.02, required 6, autolearn=disabled, AWL 0.02) X-CIS-MailScanner-From: pg@cis.strath.ac.uk X-Miltered: at discorde with ID 45586230.002 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; wiki:01 compilation:01 ocaml:01 polluting:01 wiki:01 ocaml:01 serialize:01 serialize:01 val:01 syntax:01 cheers:01 beginner's:01 bug:01 beginners:01 wrote:01 Francois Colonna wrote: > Hello, > > very often I have great difficulties to understand why I got a > compilation error in OCaml. > Instead of polluting this list with low level questions I give the > erroneous code and the questions > I have on the wiki page > http://galileo.lct.jussieu.fr/~frames/WIKI/mediawiki/index.php/OCaml_Difficulty_serialize_list > > > I shall be very grateful if some of you would be interested to go there > and solve my problem. > > François Colonna > I don't really think it was too long a problem to post on the mailing list, and it would probably help others to list the code here anyway: #let rec serialize_list string_list_a glue_a = begin match string_list_a with [] -> "" | head::rest -> (glue_with glue_a head (serialize_list rest glue_a)) end ;; val serialize_list : string list -> string -> string = # serialize_list ["a";"b";"c"] "--";; - : string = "a--b--c--" Your problem was simply one of syntax, look at what you wrote: | head::rest -> glue_with (glue_a head serialize_list( rest glue_a )) Your function glue_with takes three parameters, not one. Cheers, Peter. > _______________________________________________ > Caml-list mailing list. Subscription management: > http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list > Archives: http://caml.inria.fr > Beginner's list: http://groups.yahoo.com/group/ocaml_beginners > Bug reports: http://caml.inria.fr/bin/caml-bugs