From: Dustin Sallings <dustin@spy.net>
To: Remi Vanicat <remi.vanicat@laposte.net>
Cc: caml-list@inria.fr
Subject: Re: [Caml-list] stream conversion
Date: Tue, 9 Dec 2003 11:15:08 -0800 [thread overview]
Message-ID: <008DDE07-2A7C-11D8-BE2C-000393CFE6B8@spy.net> (raw)
In-Reply-To: <87brqi8a8i.dlv@wanadoo.fr>
On Dec 9, 2003, at 4:08, Remi Vanicat wrote:
> why do you use Stream.empty ? it would be more natural to use only
> Stream.next. As in :
> let stream_convert source =
> let chunk = ref (Stream.of_string (Stream.next source)) in
> Stream.from (fun x ->
> try
> Some (Stream.next !chunk)
> with
> Stream.Failure ->
> (* code needed when the chunk is empty *)
> )
I think I considered that, but didn't explore that direction for some
reason. I'll give that a shot. Overall, I'm looking for a bit less
duplication. It just seems like the whole thing should be smaller, so
I assume there's a better way.
> By the way, your code make the assumption that no string in the source
> stream are empty (look at what would happen in such case).
Well, I believe that I will have no empty streams in my use case, but
that's no excuse.
Thanks for the pointers.
--
Dustin Sallings
-------------------
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
next prev parent reply other threads:[~2003-12-09 19:15 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-12-09 7:56 Dustin Sallings
2003-12-09 12:08 ` Remi Vanicat
2003-12-09 16:58 ` Jean-Baptiste Rouquier
2003-12-09 17:25 ` brogoff
2003-12-09 17:40 ` Jean-Baptiste Rouquier
2003-12-09 18:30 ` Tim Freeman
2003-12-16 22:42 ` Damien Doligez
2003-12-09 19:13 ` Dustin Sallings
2003-12-09 19:15 ` Dustin Sallings [this message]
2003-12-10 1:09 ` Nicolas Cannasse
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=008DDE07-2A7C-11D8-BE2C-000393CFE6B8@spy.net \
--to=dustin@spy.net \
--cc=caml-list@inria.fr \
--cc=remi.vanicat@laposte.net \
/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