Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
Re: [Caml-list] Loop times
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Florian Hars <hars@b...>
Subject: Re: [Caml-list] Loop times
Oliver Bandel wrote:
> What does this mean for such a version of reading a file
> linewise into a list of strings?

Nothing. I/O usually isn't CPU-bound.

You may argue that this idiom looks ugly nonetheless, but this is why 
you stow it away in some utility functions, called Textfile.iter and 
Textfile.fold (anyone round here who has not writeen these?).

So your code looks something like

let input_lines chan =
    List.rev (Textfile.fold (::) chan [])

or so, depending on how you order the arguments.

Yours, Florian.

To unsubscribe, mail Archives:
Bug reports: FAQ:
Beginner's list: