<

Question: Best Way to Find List Order

I'm trying to create a list containg the indices of another list, ordered corresponding to the descending size of the first list.

Say I have the list L := [8 7 9 12];

I want to find the list i = [4 3 1 2]

I know this could be done one element at the time by doing some iterative loop:
i := [];
for j from 1 to size(L) do
    member(max(L),L,'index');
    i := [op(i),index];
    subsop(index=NULL,L);
end do;

But I was wondering if anyone knew any fancy tricks to do this more concisely(and without destroying the original list)?

Please Wait...