WLJS LogoWLJS Notebook

ReverseSort

ReverseSort[list] sorts the elements of list into reverse canonical order.

ReverseSort[list, p] sorts using the ordering function p.

Examples

Sort a list in descending order:

ReverseSort[{3, 1, 4, 1, 5, 9}]
(* {9, 5, 4, 3, 1, 1} *)

Sort strings by length (longest first):

ReverseSort[{"a", "bbb", "cc"}, StringLength]
(* {"bbb", "cc", "a"} *)

Please visit the official Wolfram Language Reference for more details.

On this page