Logo

Programming-Idioms

History of Idiom 100 > diff from v56 to v57

Edit summary for version 57 by programming-idioms.org:
Admin deletes impl 2772: No items, no c.

Version 56

2020-04-29, 16:19:43

Version 57

2020-05-03, 21:26:29

Idiom #100 Sort by a comparator

Sort elements of array-like collection items, using a comparator c.

Idiom #100 Sort by a comparator

Sort elements of array-like collection items, using a comparator c.

Variables
items,c
Extra Keywords
list
Extra Keywords
list
Code
(sort-by :age >
  [{:name "A" :age 10}
   {:name "B" :age 30}])
Comments bubble
here
:age – is an "access function"
> – is a comparator.
for more on custom comparators see doc url.
Doc URL
https://clojure.org/guides/comparators