1    type Stream<T>
2        def map<U> (f : T -> U) =
3            let stream = Stream<U>.new
4    
5            subscribe { x -> stream.push (f x) @[weak stream] }
6            |> stream.push_token
7    
8            stream.as_readonly
9    
10       def join (other : Stream<T>) =
11           let stream = Stream<T>.new
12   
13           subscribe { x -> stream.push x @[weak stream] }
14           |> stream.push_token
15   
16           other.subscribe { x -> stream.push x @[weak stream] }
17           |> stream.push_token
18   
19           stream.as_readonly
20