docs: function Stream(streamable, rest_or_pos) {
  
        var pos;
  
        // First overload:
        //   Stream(obj, restStream)
        if(rest_or_pos instanceof Stream) {
  
          var restStream = rest_or_pos;
              pos = restStream.pos;
  
          this.first = function() { return streamable; }
          this.rest  = function() { return restStream; }
          this.eos   = function() { return restStream === undefined; }
  
        // Second overload:
        //   Stream(streamable, pos?)
        } else {
  
          var length = streamable.length;
              pos = rest_or_pos || 0;
  
          this.first = function() {
            if(pos >= length)
              throw "End of stream";
            
             return streamable[pos]; 
          }
          this.rest = function() {
            var rest = new Stream(streamable, pos+1);
            // patch rest() to only calculate it once
            this.rest = function() { return rest; }
            return rest;
          }
          this.eos = function() { return pos >= length }
        }
  
        this.pos = function() { return pos; }
  
         // required by capture operator < ... >
        this.upTo = function(other) {
  
          if(typeof streamable === 'string')
            return streamable.slice(pos, other.pos());
  
          var consumed = [],
              current = this;
  
          while(current.pos() < after.pos()) {
            consumed.push(current.first());
            current = current.rest();
          }
          return consumed;
        }
        
        this.input = function() { return streamable; }
      }