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 JAA25320; Thu, 22 May 2003 09:39:44 +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 JAA25361 for ; Thu, 22 May 2003 09:39:43 +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 h4M7dgH05471 for ; Thu, 22 May 2003 09:39:42 +0200 (MET DST) Received: from localhost (localhost.localdomain [127.0.0.1]) by teutates.kfunigraz.ac.at (Postfix) with ESMTP id 9851B3D2224; Thu, 22 May 2003 09:39:36 +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 28857-06; Thu, 22 May 2003 09:39:35 +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 0B2313D2191; Thu, 22 May 2003 09:39:35 +0200 (CEST) Message-ID: <3ECC6DD5.9050509@stud.uni-graz.at> Date: Thu, 22 May 2003 08:27:33 +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: Markus Mottl 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> <3ECB189C.5090400@stud.uni-graz.at> <20030521091120.GA9455@fichte.ai.univie.ac.at> 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 bigloo:01 psilab:01 3.02:01 matlab:01 python:01 goody:01 plotting:01 python's:01 ranked:99 idl:01 ocaml:01 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk Markus Mottl wrote: > > > Thanks for this version. Without any insult, it works well and takes for this legendary file now 25 seconds, though, I find the version ugly. The Clean, Bigloo, Fortran 95 and C++ version more or less takes the same time. One thing which surprised me most is the fact that reading this file takes /only/ 40 seconds under PsiLAB. For all the innocent: PsiLAB is based on OCaml 3.02 and is like an interpreter for scientific computing ala Matlab or Python+Numeric+Dislin. Why you should try PsiLAB: a) You are really using OCaml 3.02 with the goody of some important linear algebra routines and a good plotting library (PLPLOT) b) As it seems very good performance c) To go on: the syntax is not as crippled as Python's Numeric stuff. I regard Franky D. and his team for fostering Numeric. I think it is important to have one from the acknowledged LLNL who is using Python, because the LLNL is high ranked and nobody will laugh at you when you say: why are you using Matlab or IDL guy there are plenty of alternatives out there. But the Numeric library syntax is crippled and I never got used to. However, I think Python is overly complicated to master. But there remains my requirement for a better OCaml solution. I mean we are talking about functional programming. My C++ version based on templates has some elegance too, though, it is more or less based on this awkward "string indexing". However, t should be possible to walk up Clean's way: 1) Convert the string-line to a character-list: [x\\x<-: string-line] 2) Use takeWhile until you encounter the seperator ',' 3) Convert the string-number of 2) to a real number and store it in the list 4) Use dropWhile until you encounter ',' and go on with rest of the string until you encounter the next occurence of ',' in point 2) This, oh dear Watson is what I mean with elegance. No need of string indexing counting or other error prone stuff. My Bigloo (Scheme) version does exactly the same as my Clean version. Okay, it uses takeWhile and dropWhile which is not standard Scheme, but the two functions can be easily implemenetd by a few lines and will never spoil the "platform" independence of the code. Biglo does exactly what I described in the aformentioned points. First it converts the string to a character-list (standard Scheme function) and then it goes on. So, this must also be possible in OCaml - or must not? 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