English version
Accueil     Ŕ propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis ŕ jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml ŕ l'adresse ocaml.org.

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: 2003-05-20 (10:55)
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.

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