function transpose(A) { return map(range(sizeof A), function(k, idx) { return map(A, function(k, row) { return row[idx]; }); }); }