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 49420BC69 for ; Sat, 24 Feb 2007 19:43:35 +0100 (CET) Received: from mailout1.informatik.tu-muenchen.de (mailout1.informatik.tu-muenchen.de [131.159.0.18]) by discorde.inria.fr (8.13.6/8.13.6) with ESMTP id l1OIhYC0002848 for ; Sat, 24 Feb 2007 19:43:35 +0100 Received: from [192.168.1.108] (c-69-253-130-158.hsd1.nj.comcast.net [69.253.130.158]) by mail.in.tum.de (Postfix) with ESMTP id F31B328B2 for ; Sat, 24 Feb 2007 19:43:33 +0100 (MET) Message-ID: <45E08753.40600@in.tum.de> Date: Sat, 24 Feb 2007 13:43:31 -0500 From: christian konrad User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.12) Gecko/20050915 X-Accept-Language: en-us, en MIME-Version: 1.0 To: caml-list@yquem.inria.fr Subject: beginners list Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new/sophie/sophos at mailrelay2.informatik.tu-muenchen.de X-Miltered: at discorde with ID 45E08756.003 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; ocaml:01 scanf:01 sscanf:01 beginners:01 beginners:01 wrote:01 rec:01 rec:01 compile:01 int:01 int:01 expression:02 expression:02 match:02 string:02 Hello again, I just signed up to the beginners with the message: "/Your membership to the ocaml_beginners mailing list is waiting for the moderator's approval." /so for a last time I misuse this list, sorry. I wrote this piece of code: type ergebnis = {teamid1: int; teamid2: int; goals1: int; goals2: int};; type spieltag = {number: int; ergebnisse: ergebnis list};; ... let rec readSpieltagelist filehandle numberofgames = let createErgebnis tid1 tid2 g1 g2 = {teamid1=tid1; teamid2=tid2; goals1=g1; goals2=g2;} in let rec readErgebnisse fh number = match number with | 0 -> [] | n -> let line = (input_line fh) in (Scanf.sscanf line "%d\t%d\t%d\t%d" createErgebnis):: (readErgebnisse fh (number-1)); in try let spieltag = int_of_string(read_line filehandle) in let ergebnislist = (readErgebnisse filehandle numberofgames) in {number=spieltag; ergebnisse=ergebnislist;} :: (readSpieltagelist filehandle numberofgames); with End_of_file -> [];; with the hope to read from a file informations like: 1 1 2 3 4 3 2 1 6 4 2 1 9 2 1 4 9 2 3 2 1 9 9 1 2 3 3 ... I would call: readSpieltagelist filehandle 3 in that case. This code doesn't compile, I get an error with the variable filehandle in this expression: let ergebnislist = (readErgebnisse filehandle numberofgames) in "This expression has type unit but is here used with type in_channel" Why that?? I really do not understand that. Do I use "filehandle" somewhere as a unit type? Where, why? Thanks for help, chris //