How do I sort one vector based on the values of another?
Say I have predefined order:
(def order ["0M","6M","1Y","2Y","3Y"])
I have another vector ["0M","1Y","6M"] (may or may not contain all elements of vector “order”)
Output should be ["0M","6M","1Y"]
Notice that
sort-byreturns a sequence. If you absolutely need a vector result, you can feed the output tovec.