How to turn a matrix of nested vectors into a vector of nested vectors

Viewed 67

I am producing a matrix of pairs (= nested vectors) like so:

x←⍳10
y←⍳10
x∘.,y

But for further processing I need to have the pairs in one vector of pairs. If I apply ravel:

,/x∘.,y

then the pairs are not anymore nested. How to transform the matrix into a vector and retain the nested pairs?

1 Answers

You just need to ravel the matrix:

,x∘.,y

This reshapes the matrix into a vector containing the same elements in ravel order.

Related