Zig-zag matrix: Difference between revisions
m
→Functional (ES 5)
Line 1,707:
) : [];
}
// Recursively read off n heads from the diagonals (as rows)
// [[n]] -> [[n]]
Line 1,717:
return x[0];
})].concat(
nHeads(n, [].concat.apply([], lstFirst.map(function (x) {
}▼
);
}
Line 1,733 ⟶ 1,731:
// Recursively take n heads from the alternately reversed diagonals
return nHeads(n, diagonals(n, 1, range(0, (n * n) - 1)).map(function (x, i) {
return
▲ }));
})(5);</lang>
|