* stream
@ 1996-02-28 9:38 Choun-Tong LIEU
1996-02-28 18:36 ` stream Michel Mauny
0 siblings, 1 reply; 2+ messages in thread
From: Choun-Tong LIEU @ 1996-02-28 9:38 UTC (permalink / raw)
To: caml-list
Bonjour,
J'ai une conversation "bizarre" avec caml-light a propos des stream. J'ai
essaye de fouiller dans les docs, je n'ai pas trouve de reponse.
Est ce que caml-light privilegie le dernier element non terminal des stream ?
Voici la conversation :
> Caml Light version 0.61
#let pr flux = do_stream print_int flux;;
pr : int stream -> unit = <fun>
#let toto = [< '1; '2; '3 >];;
toto : int stream = <abstract>
#pr toto;;
123- : unit = ()
#pr toto;;
- : unit = ()
(***** Ok, jusqu'a la, je comprends. do_stream a vide toto.
*****)
#let toto = [< '1; '2; '3 >];;
toto : int stream = <abstract>
#let tata = [< '4; '5 >];;
tata : int stream = <abstract>
#pr [< toto; tata >];;
12345- : unit = ()
#pr toto;;
- : unit = ()
(***** Ok, jusqu'a la, je comprends. do_stream a vide toto. *****)
#pr tata;;
45- : unit = ()
(***** Je comprends un peu moins ou pas du tout. Remarquons tata est a la fin
de [< toto; tata >]
*****)
(***** Ok, on recommence cette fois ci avec un seul.
*****)
#let toto = [< '1; '2; '3 >];;
toto : int stream = <abstract>
#pr [< toto >];;
123- : unit = ()
#pr [< toto >];;
123- : unit = ()
#pr toto;;
123- : unit = ()
(***** La je devine que toto n'est pas vide par do_stream parce que toto est
le dernier dans [< toto >].
*****)
#pr toto;;
- : unit = ()
Merci pour vos reponses. Cordialement votre.
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: stream
1996-02-28 9:38 stream Choun-Tong LIEU
@ 1996-02-28 18:36 ` Michel Mauny
0 siblings, 0 replies; 2+ messages in thread
From: Michel Mauny @ 1996-02-28 18:36 UTC (permalink / raw)
To: Choun-Tong LIEU; +Cc: caml-list
Bonjour,
> J'ai une conversation "bizarre" avec caml-light a propos des
> stream. J'ai essaye de fouiller dans les docs, je n'ai pas trouve de
> reponse.
>
> Est ce que caml-light privilegie le dernier element non
> terminal des stream ?
> [...]
> #pr toto;;
> 123- : unit = ()
(***** Je comprends un peu moins ou pas du tout. Remarquons tata est a la fin
> de [< toto; tata >]
> *****)
C'est un comportement décrit dans la liste des bugs connus de
Caml-Light 0.7. Vous vous attendiez à juste titre à ce que "tata"
soit vidé par le parcours de [< toto; tata >].
Vous trouverez ci-dessous un extrait du fichier KNOWN-BUGS de la
distribution 0.7, qui indique notamment comment contourner ce bug.
Cordialement,
--
Michel Mauny
---------------------------------------------------------------------------
The following problems have not been fixed at the time of this release:
1- Stream concatenation using [< ... >] does not always preserve the
sharing among streams, and sometimes duplicate stream subcomponents.
For instance, if you define s' = [< '1; s >] and then read alternatively
from s' and from s, a given element of s can be read twice.
The problem occurs only if s is in tail position inside s'.
To guarantee proper sharing, move s in non-tail position, e.g.
take s' = [< '1; s; [<>] >].
---------------------------------------------------------------------------
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~1996-02-29 12:39 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1996-02-28 9:38 stream Choun-Tong LIEU
1996-02-28 18:36 ` stream Michel Mauny
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox