Wraps an iterable factory inside a class that allows it to be repeatedly iterated without state, same as how Arrays work
function defer(func) {
    return new (class {
        constructor(generator) {
            this.generator = generator;
        }
        [Symbol.iterator]() {
            return this.generator()[Symbol.iterator]();
        }
    })(func);
}