My problem is that I have a defined function, say, foo
, and I am using the built in Sort
function to order a sequence of calls
foo[x1], food[x2], ..., foo[xn]
from lowest value to greatest.
However,
Sort[{foo[x1], foo[x2]}, ..., foo[xn]]
outputs the numerical evaluation of foo[xi]
so that (for example) I get an output like
{1.1, 3.9 ,..., 9.7}
Assuming foo[x11]
evaluates to the lowest, foo[x3]
the second lowest and foo[x108]
the greatest numerical value, I want the output to be
{foo[x11], foo[x3], ..., foo[x108]}
I also tried
HoldForm[Sort[{foo[x1], foo[x2]},...,foo[xn]]]
and using HoldForm
on the individual elements given to Sort
, but neither worked.
Perhaps there is a simpler way of doing what I want to do (list me the order of foo[xi] from lowest value to greatest). Any ideas?
SortBy
:SortBy[{1.1, 3.9, ..}, foo]
$\endgroup$