Wolfram ResearchProductsPurchasingServices & ResourcesAbout UsOur Sites
Mathematica > Rearranging & Restructuring Lists >

SortBy

SortBy[list, f]
sorts the elements of list in the order defined by applying f to each of them.
  • SortBy[{e1, e2, e3, ...}, f] sorts the ei so that the f[ei] lie in canonical order.
  • If some of the f[ei] are the same, then the canonical order of the corresponding ei is used.
  • SortBy uses the canonical ordering described in the notes for Sort.
  • SortBy can be used on expressions with any head, not only List.
New in 6
© 2008 Wolfram Research, Inc. japanese.gif
Ask a question about this page  |  Suggest an improvement  |  Leave a message for the team