We deliver solutions for the AI eraâcombining symbolic computation, data-driven insights and deep technology expertise.
Sort[list]
sorts the elements of list into canonical order.
Sort[list,p]
sorts using the ordering function p.
DetailsSort by comparing the second part of each element:
Scope (10) Input Data (5)Sort works with any head, not just List:
Sort elements in an Association according to their values:
Sort the rows of a Tabular object by sorting the first column:
Sort the rows of a Dataset object by their first element:
Ordering Functions (5)Sort using Greater as the ordering function:
Use GreaterEqual to maintain the relative order of equal elements:
Use NumericalOrder to allow complex numbers and number-like expressions:
Sort according to the rules of a particular language with AlphabeticOrder:
Define a custom ordering function that puts symbols ahead of numbers:
Use a pure function ordering function:
Applications (5)Sort strings by dictionary order:
Properties & Relations (8)Shorter expressions are sorted before longer ones:
Explicit numbers are sorted in numerical order:
Orderless functions sort in the same order as Sort:
Collect a list of the comparisons done:
Sort[list] is equivalent to list[[Ordering[list]]]:
Sort[list] is equivalent to SortBy[list,Identity]:
Possible Issues (2)Numeric expressions are sorted by structure as well as numerical value:
This order follows the normal rules for expressions based on their FullForm:
Elements whose order is not determined by the ordering function may not be kept in order:
Neat Examples (1)Show comparisons made in doing a sort:
Wolfram Research (1988), Sort, Wolfram Language function, https://reference.wolfram.com/language/ref/Sort.html (updated 2017). TextWolfram Research (1988), Sort, Wolfram Language function, https://reference.wolfram.com/language/ref/Sort.html (updated 2017).
CMSWolfram Language. 1988. "Sort." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2017. https://reference.wolfram.com/language/ref/Sort.html.
APAWolfram Language. (1988). Sort. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/Sort.html
BibTeX@misc{reference.wolfram_2025_sort, author="Wolfram Research", title="{Sort}", year="2017", howpublished="\url{https://reference.wolfram.com/language/ref/Sort.html}", note=[Accessed: 12-July-2025 ]}
BibLaTeX@online{reference.wolfram_2025_sort, organization={Wolfram Research}, title={Sort}, year={2017}, url={https://reference.wolfram.com/language/ref/Sort.html}, note=[Accessed: 12-July-2025 ]}
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4