Play the given Iterable, and then it N more times
function repeat(times) {
    return function* (it) {
        const buffer = [];
        for (const item of it) {
            buffer.push(item);
            yield item;
        }
        for (let i = 0; i < times; ++i) {
            yield* buffer;
        }
    };
}