/**
 * @template T
 * @param {T[]} sequence
 * @returns {function(): T}
 */
export function makeSequenceLoop(sequence) {
    let i = 0;

    const data = sequence.slice();
    const n = data.length;


    return function sequenceLoop() {
        const datum = data[i % n];

        i++;

        return datum;
    }
}
