From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id UAA21479; Tue, 9 Dec 2003 20:15:21 +0100 (MET) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id UAA20711 for ; Tue, 9 Dec 2003 20:15:18 +0100 (MET) Received: from bob.west.spy.net (mail.west.spy.net [66.149.231.226]) by concorde.inria.fr (8.11.1/8.11.1) with ESMTP id hB9JFGr02429 for ; Tue, 9 Dec 2003 20:15:16 +0100 (MET) Received: from [10.9.254.240] (sjc-dist3-e3.2wire.com [63.203.253.2]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (Client did not present a certificate) by bob.west.spy.net (Postfix) with ESMTP id 5EF9959D9; Tue, 9 Dec 2003 11:15:14 -0800 (PST) In-Reply-To: <87brqi8a8i.dlv@wanadoo.fr> References: <2111F26F-2A1D-11D8-8637-000393CB0F1E@spy.net> <87brqi8a8i.dlv@wanadoo.fr> Mime-Version: 1.0 (Apple Message framework v606) Content-Type: text/plain; charset=US-ASCII; format=flowed Message-Id: <008DDE07-2A7C-11D8-BE2C-000393CFE6B8@spy.net> Content-Transfer-Encoding: 7bit Cc: caml-list@inria.fr From: Dustin Sallings Subject: Re: [Caml-list] stream conversion Date: Tue, 9 Dec 2003 11:15:08 -0800 To: Remi Vanicat X-Mailer: Apple Mail (2.606) X-Loop: caml-list@inria.fr X-Spam: no; 0.00; caml-list:01 pointers:01 remi:01 vanicat:01 string:03 string:03 chunk:03 chunk:03 wrote:03 08,:03 let:04 let:04 seems:05 assumption:06 source:07 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk 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