Why b2 has shape (3,)? Seems the dimension except the first one is missing. What’s the right way to use lambda expression to initialize a matrix from vectors?

What you could do loop over all values of a while looping the power. So now it takes the first value of a and then to the power 1:3, then it takes the second value of a etc.

Because it is a Vector of Arrays. To elaborate, [f(i) for i in 1:N] is an array comprehension and will result in a 1D Array (aka a Vector) of length N (or size (N,)). The element type of the Vector will be determined by the output of f(i). So in your case, you end up with a Vector of Matrixes.