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 WAA20716; Sat, 22 Dec 2001 22:46:59 +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 WAA20867 for ; Sat, 22 Dec 2001 22:46:57 +0100 (MET) Received: from stb-mail-01.adept.za.net (stb-mail-01.adept.za.net [64.245.11.2]) by nez-perce.inria.fr (8.11.1/8.11.1) with ESMTP id fBMLkp901245 for ; Sat, 22 Dec 2001 22:46:54 +0100 (MET) Received: from spyker.adept.co.za (p83.dialup-01.adept.za.net [64.245.12.83]) by stb-mail-01.adept.za.net (Postfix) with ESMTP id AB4961FF88 for ; Sat, 22 Dec 2001 23:46:41 +0200 (SAST) Received: from js by spyker.adept.co.za with local (Exim 3.32 #1 (Debian)) id 16HtvZ-000377-00 for ; Sat, 22 Dec 2001 23:43:33 +0200 Date: Sat, 22 Dec 2001 23:43:33 +0200 From: Johann Spies To: caml-list@inria.fr Subject: [Caml-list] Why do I get a syntax error? Message-ID: <20011222234333.A11911@adept.co.za> Mail-Followup-To: Johann Spies , caml-list@inria.fr Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.3.20i Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk I want to write a function which I can use to determine the maximum length of a field in a database query so I want to build a list of fieldnames and their lengths. I found it a lot more difficult to build such a list than would be the case in python which I know better. I am trying to figure out how ocaml would handle this but got stuck with the following code. The compiler complains about a syntax error in the line after the last line of code. I apologize if it a stupid question, but I can not figure out why. ------------------------------------------------------------- let lys1 = ["a";"b";"c"] type rek = { naam : string; lengte : int } let rec bourekordlys lys nuwelys = match lys with [] -> nuwelys | h::t -> let rekord = {naam = h; lengte = 0} in let l = List.append nuwelys [rekord] in bourekordlys t l;; let l = [];; let ll = bourekordlys lys1 l in let lm = [] in let rec veranderde_lys ll lm = match ll with [] -> lm | h::t -> let n = h.naam in let lg = h.lengte + 5 in let lz = List.append lm [{naam=n;lengte=lg}]; veranderde_lys t lz --------------------------------------------------------- What is wrong here? Johann -- J.H. Spies - Tel. 021-982 2694 / 082 782 0336 / 021-808 4036(w) Posbus 4668, Tygervallei 7536 "And we know that all things work together for good to them that love God, to them who are the called according to his purpose." Romans 8:28 ------------------- Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr