Содомия

Jan 27, 2016 01:33



def replicateM(n, xs) {
    let res = [];
    for (let i = 0; i < n; ++i) {
        push(res, bind xs);
    }
    wrap res;
}

print(replicateM(2, [1, 2, 3]);

// [[1, 1], [1, 2], [1, 3],
//  [2, 1], [2, 2], [2, 3],
//  [3, 1], [3, 2], [3, 3]]
Previous post Next post
Up