Sort in reverse order

From CodeCodex

Revision as of 20:24, 3 March 2011 by 79.91.219.32 (Talk)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Implementations[edit]

Erlang[edit]

reverse_sort(List) ->
    lists:reverse( lists:sort(List) ).

Java[edit]

Arrays.sort (myArray, Collections.reverseOrder());

Ruby[edit]

def reverse_sort(ary)
  ary.sort.reverse
end

Tcl[edit]

lsort -decreasing [list 7 6 9 2 3 1 ]