Skip to main content
2 of 2
Routine clean-up
m_goldberg
  • 108.1k
  • 16
  • 104
  • 259

How to order a list to match the order of another list?

How can I order a list to match the order of anoter list ?

For example: Suppose I have the lists x = {3, 1, 5, 7} and y = {3, 7, 1, 5}. How can I order x to have the order of y?

This question is interesting when each element of x has composite values, for example, as a list or an association.

faysou
  • 11k
  • 3
  • 50
  • 131