Question: index of sorted list/vector

 

> x := [1, 5, 3, 7];
                                  [1, 5, 3, 7]
> y := sort(x);
                                  [1, 3, 5, 7]
 

Is there a simple way or a function to have a list of indices Ind such that

x[ Ind[i] ] = y[i] for i=1..4?

That is, I'd like to know which element of x is the first, second, etc. in y.

Thank you.

Please Wait...