diff --git a/streams-endless-arrays/streams-endless-arrays.js b/streams-endless-arrays/streams-endless-arrays.js new file mode 100644 index 0000000..9b51529 --- /dev/null +++ b/streams-endless-arrays/streams-endless-arrays.js @@ -0,0 +1,13 @@ +var Stream = function(start, output, stepping) { + this.curr = start; + this._get = output; + this._next = stepping; +}; +Stream.prototype = { + head: function() { + return this._get(this.curr); + }, + tail: function() { + return new Stream(this._next(this.curr), this._get, this._next); + } +}; \ No newline at end of file