Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] ocaml and large development projects
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Siegfried Gonzi <siegfried.gonzi@s...>
Subject: Re: [Caml-list] Reading a file
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