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
[Caml-list] stream conversion
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2003-12-09 (19:15)
From: Dustin Sallings <dustin@s...>
Subject: Re: [Caml-list] stream conversion

On Dec 9, 2003, at 4:08, Remi Vanicat wrote:

> why do you use Stream.empty ? it would be more natural to use only
> As in :
> let stream_convert source =
>   let chunk = ref (Stream.of_string ( source)) in
>   Stream.from (fun x ->
>     try
>       Some ( !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 Archives:
Bug reports: FAQ:
Beginner's list: