Специализни шаблонца! (udpn) wrote,
Специализни шаблонца!
udpn

Содомия

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]]
Subscribe
  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 2 comments