Основано на предложении @ берги mapIndexed
const matrix = [
['a1', 'b1', 'c1', 'd1'],
['a2', 'b2', 'c2', 'd2'],
['a3', 'b3', 'c3', 'd3'],
['a4', 'b4', 'c4', 'd4'],
]
const mapIndexed = addIndex(map)
const map2d = (f, l) =>
mapIndexed((row, x) =>
mapIndexed((col, y) => f(col, x, y), row), l)
map2d((...x) => x, matrix)
// => [[["a1", 0, 0], ["b1", 0, 1], ["c1", 0, 2] etc...