From: Ivan Gotovchits <ivg@ieee.org>
To: caml-list@inria.fr
Subject: [Caml-list] Lwt idioms: iterating
Date: Wed, 23 Jan 2013 09:02:34 +0400 [thread overview]
Message-ID: <87pq0w4hlh.fsf@golf.niidar.ru> (raw)
What is a best practice to implement a common iterative operations with
Lwt?
For example, I have a data structure incapsulating some
collection. Interface of the structure includes some iterators, i.e.
val iter (e -> unit) -> t -> unit
Now, I would like to output each element of type e using one of the
functions from Lwt_io module.
I see two solutions and neither I like:
1. Use Buffer.t to accumulate text while iterating, then output it.
2. Use Lwt_stream.t for the same purpose.
Both solutions a rather imperative and too ad-hoc (not scales to other
iterators and tasks).
Are there any idiomatic solutions for such common tasks in Lwt?
--
(__)
(oo)
/------\/
/ | ||
* /\---/\
~~ ~~
...."Have you mooed today?"...
next reply other threads:[~2013-01-23 5:02 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-23 5:02 Ivan Gotovchits [this message]
2013-01-23 10:15 ` Raphael Proust
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=87pq0w4hlh.fsf@golf.niidar.ru \
--to=ivg@ieee.org \
--cc=caml-list@inria.fr \
/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