Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] (Sorry for my last post) lazyness, exceptions?, ocaml syntax rule-of-thumbs
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Florian Hars <florian@h...>
Subject: Re: [Caml-list] (Sorry for my last post) lazyness, exceptions?, ocaml syntax rule-of-thumbs
Kontra, Gergely wrote:
  > One point was ocaml is really obscure is the file reading: it needed to
  > wrap the line-reading in an infinite loop, and this loop is ended via an
  > exception. I think End_of_file is not an exception, it is just an event.

For processing files a line at a time, I once decided to write a module
Textfile with the two methods

val iter : (string -> unit) -> in_channel -> unit
val fold : ('a -> string -> 'a) -> 'a -> in_channel -> 'a

and forget about whatever ugly things happen in there.

Yours, Florian.



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