We examine the OCaml function makeTee that operates in a context of streams:
makeTee sink1 sink2 = fun x -> (sink1 x; sink2 x) takes two sinks and returns a sink which given a value, delivers that value to each of the two sinks. Here a ‘sink’ is a function that, like C’s putc, disposes of a value.
(define (makeTee sink1 sink2) (lambda (x) (sink1 x) (sink2 x)))
class sink {
  virtual void put(int);};
class tee: public sink{
  sink sink1, sink2;
  public: sink(sink sinka, sink sinkb){
   sink1 = sinka; sink2 = sinkb;}
  void put(int x) {sink1.put(x); sink2.put(x);}}