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: Markus Mottl <markus@o...>
Subject: Re: [Caml-list] Reading a file
Siegfried Gonzi schrieb am Dienstag, den 20. Mai 2003:
> Is there a better way in Ocaml to read a file line by line than via the 
> read_line function?

Yes: use "input_line"! "read_line" flushes stdout, which you'll probably
not need.

> I am not sure how quick List.rev actually is?

As quick as it can be...

This problem is most likely not related to List.rev.

> In Bigloo reversing a list 
> has more or less no overhead. My Bigloo function is similar to my OCaml 
> function. Could it be that OCaml is that slow because I use "try and 
> with" constructs in order to check for the end of a file?

If you create the exception handler within a loop, this will also be a bit
costly. The loop should be within the exception handler, not vice versa.

Regards,
Markus Mottl

-- 
Markus Mottl          http://www.oefai.at/~markus          markus@oefai.at

-------------------
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