What would be the simplest method of sorting a list of variables according to the value they represent:
Let:
a = 5; b = 4; c = 3; d = 2; e = 1;
varList = {a, b, c, d, e};
Sort[varList]
Renders:
{1, 2, 3, 4, 5}
While my preferred output would be:
{e, d, c, b, a}
I expect the answer will be embarrassingly simple.
Part
, 4th bullet point. It says that forexpr[[{a,b,c}]]
it will applyHead
of expression for result. So I'm using something likeDefer[{1,2,3}][[{1}, {3,2,1}]]
to reorder things but preserve headDefer
, it is done by{1}
. Minimal example is:Hold[{1,2,3}][[ {1}, 1]]
, take a look what it evaluates to. $\endgroup$