Surprisingly pairs
can’t be used with map
, otherwise this might be another neat way:
julia> map(enumerate(rand(Bool, 2,10))) do (i,v)
i * v
end
2×10 Matrix{Int64}:
0 0 5 0 9 11 0 0 0 0
2 0 0 8 10 0 14 0 18 0
julia> map(pairs(rand(Bool, 2,10))) do (i,v)
prod(i.I) * v
end
ERROR: map is not defined on dictionaries