caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Florian Hars <hars@bik-gmbh.de>
To: Oliver Bandel <oliver@first.in-berlin.de>
Cc: caml-list@inria.fr
Subject: Re: [Caml-list] Loop times
Date: Tue, 18 Mar 2003 16:21:34 +0100	[thread overview]
Message-ID: <3E77397E.6040400@bik-gmbh.de> (raw)
In-Reply-To: <20030318085232.GB372@first.in-berlin.de>

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


  reply	other threads:[~2003-03-18 15:21 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-03-18  8:52 Oliver Bandel
2003-03-18 15:21 ` Florian Hars [this message]
2003-03-18 15:40 ` Noel Welsh
2003-03-19  6:48 ` Daniel M. Albro
  -- strict thread matches above, loose matches on Subject: below --
2003-03-13 21:53 Daniel M. Albro
2003-03-17 11:39 ` Fabrice Le Fessant
2003-03-17 18:59   ` Daniel M. Albro
     [not found]     ` <20030317214841.GA467@first.in-berlin.de>
2003-03-17 22:01       ` Daniel M. Albro
2003-03-18  9:57         ` Oliver Bandel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3E77397E.6040400@bik-gmbh.de \
    --to=hars@bik-gmbh.de \
    --cc=caml-list@inria.fr \
    --cc=oliver@first.in-berlin.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).