Question: Sorting a list based on another list

Hi

This question may have been asked before but I cannot find it!

I am currently have 3 lists:

L:= [1,3,5,2,3]

M:=[4,2,4,6,2]

R:= [5,3,2,1,4]

I would like to be able to come up with a way (I assume a procedure) where I can order L and M based on the numerical order of R. So in this case that would be:

R:=[1,2,3,4,5]

L:=[2,5,3,3,1]

M:=[6,4,2,2,4]

I hope this makes sense? Any help would be greatly appreciated!

 

Please Wait...