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 PAA18505; Tue, 20 May 2003 15:33:29 +0200 (MET DST) 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 PAA18496 for ; Tue, 20 May 2003 15:33:27 +0200 (MET DST) Received: from teutates.kfunigraz.ac.at (TEUTATES.kfunigraz.ac.at [143.50.129.26]) by concorde.inria.fr (8.11.1/8.11.1) with ESMTP id h4KDXQH11749 for ; Tue, 20 May 2003 15:33:27 +0200 (MET DST) Received: from localhost (localhost.localdomain [127.0.0.1]) by teutates.kfunigraz.ac.at (Postfix) with ESMTP id 9BEED3D2228; Tue, 20 May 2003 15:33:24 +0200 (CEST) Received: from teutates.kfunigraz.ac.at ([127.0.0.1]) by localhost (teutates.kfunigraz.ac.at [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 10691-05; Tue, 20 May 2003 15:33:22 +0200 (CEST) Received: from stud.uni-graz.at (IGAM08AV.kfunigraz.ac.at [143.50.39.35]) by teutates.kfunigraz.ac.at (Postfix) with ESMTP id 566993D2191; Tue, 20 May 2003 15:33:19 +0200 (CEST) Message-ID: <3ECA1DBF.70702@stud.uni-graz.at> Date: Tue, 20 May 2003 14:21:19 +0200 From: Siegfried Gonzi Organization: Universitaet Graz User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:0.9.8) Gecko/20020204 X-Accept-Language: en-us MIME-Version: 1.0 To: Michal Moskal Cc: caml-list@inria.fr Subject: Re: [Caml-list] Reading a file References: <4.3.2.7.2.20030517225010.04b748a0@localhost> <4.3.2.7.2.20030519120753.04545700@localhost> <200305201007.17990.wolfgang.mueller2@uni-bayreuth.de> <3EC9EA84.3070404@stud.uni-graz.at> <20030520132032.GA9564@roke.freak> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at stud.uni-graz.at X-Spam: no; 0.00; siegfried:01 gonzi:01 stud:99 caml-list:01 michal:01 moskal:01 estimating:01 ocaml:01 exists:01 lazy:02 string:03 wrote:03 converts:03 btw:03 snippet:04 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk Michal Moskal wrote: > >>Why my Clean function is that fast is incomprehensible for me. Does one >>know whether there exists a function in OCaml which converts a String to >>a character-list? I use this construct in Clean then in order to extract >>floating point numbers from that character list: ['1','.','2',...] and >>store this floating point numbers via pattern matching in my result-list. >> > >If you expand each line of megabyte file to list of characters -- it >cannot be fast. > I will post the Clean snippet tomorrow. In the evening I will try other OCaml solutions. When I was first running my Clean program I couldn't believe it how fast it was; I was thinking of something like: "Clean is may be cheating me due to lazy evaluation, because as a return result I used the first list entry and I thought lazy evaluation just reads the first line of the 50MB file and nothing more". I did the test again but this time with estimating the length of the return list which ensures that the complete file becomes worked through. Converting strings to list of chars is fast in Clean, as it seems. As far as I can remember I did the conversion ala: [x\\x <-: y] where y is the string (btw: '<-:' denotes "from array to list") S. Gonzi ------------------- 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