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 BAA01788; Tue, 18 Nov 2003 01:18:22 +0100 (MET) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id BAA01407 for ; Tue, 18 Nov 2003 01:18:21 +0100 (MET) Received: from mta01-svc.ntlworld.com (mta01-svc.ntlworld.com [62.253.162.41]) by nez-perce.inria.fr (8.11.1/8.11.1) with ESMTP id hAI0IK105783 for ; Tue, 18 Nov 2003 01:18:20 +0100 (MET) Received: from ntlworld.com ([80.4.69.207]) by mta01-svc.ntlworld.com (InterMail vM.4.01.03.37 201-229-121-137-20020806) with ESMTP id <20031118001819.RQOG29642.mta01-svc.ntlworld.com@ntlworld.com> for ; Tue, 18 Nov 2003 00:18:19 +0000 Message-ID: <3FB9668D.3060709@ntlworld.com> Date: Tue, 18 Nov 2003 00:23:41 +0000 From: "chris.danx" User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.5) Gecko/20031014 Thunderbird/0.3 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Caml Mailing List Subject: [Caml-list] Records: syntax error... Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Loop: caml-list@inria.fr X-Spam: no; 0.00; ntlworld:99 dlist:01 chris:01 chris:01 bool:01 bool:01 ocaml:01 ocaml:01 syntax:02 syntax:02 match:02 let:04 complains:04 define:05 pattern:06 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk Hi, I'm working my way through the ocaml book, and came across one exercise I can't get to work (sort of). The exercise asked to define insert over the following type type 'a dList = {l: 'a list; compare : 'a -> 'a -> bool; in_order : bool};; I can get it to work with code similar to the solution, but since I had defined a merge function in the same file I decided to try using pattern matching on the record... let insert item dl = match dl with {l = _; compare = _; in_order = true} -> {merge dl.compare (dl.l, [item]), dl.compare, true} | {l = _; compare = _; in_order = false} -> {item::dl.l, dl.compare, false};; but ocaml complains of a syntax error at dl.compare. What did I do wrong? Thanks, Chris ------------------- 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