Files
codewars/streams-endless-arrays/streams-endless-arrays.js
2017-08-16 11:03:14 +02:00

13 lines
296 B
JavaScript

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);
}
};