Having a list of 2x1 vectors, I wanted to do a for loop for the array and hcat
each element with each vector to create a 2x2 matrix. I was able to get what I wanted with a list comprehension but I was wondering if there’s a way to do it with broadcasting hcat.()
instread? I guess I’m just used to R and recycling to common vector sizes.
arrays = [[0,0], [1, 1], [1, 2], [2, 1]]
new_array = []
for i in arrays
transformed = [hcat(i, a) for a in arrays]
push!(new_array, transformed)
end