Version française
Home     About     Download     Resources     Contact us    
Browse thread
stream feature
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Vincent.Poirriez@u...
Subject: stream feature
Hello every body,
(Hope my english is not to bad)
 I am wondering if it's a bug or a feature:

  Objective Caml version 1.03

# let s = [<''c';''d'>];;
val s : char Stream.t = <abstr>
# let t = [<''a';''b';s;''e'>];;
val t : char Stream.t = <abstr>
# Stream.next s;;
- : char = 'c'
# Stream.iter print_char t;print_newline();;
abde
- : unit = ()
# Stream.next t;;
Uncaught exception: Parse_failure

until this point, no surprise

# Stream.next s;;
- : char = 'd'

But here, I was expecting s to be empty as t. 


Thus s is not really a sub-stream of t and we can't consider t to contain
a copy of s as if the head of s is consumed, it desappears of t to.

To resume, I found surprising the following non symetric feature 
let s appears as a sub stream of t, if s is consumed, it is consumed in t,
if t is consumed, it is not consumed in s


-- 
Vincent POIRRIEZ                
Tel: (33) {0}3 27 14 13 33   
Fax: (33) {0}3 27 14 11 50      
email: Vincent.Poirriez@univ-valenciennes.fr
ISTV Université de Valenciennes Le Mont Houy BP 311 F59304 Valenciennes CEDEX