Programming-Idioms

History of Idiom 28 > diff from v18 to v19

Edit summary for version 19 :

Version 18

2015-09-03, 15:28:47

Version 19

2015-09-04, 12:36:57

Idiom #28 Sort by a property

Sort elements of array-like collection items in ascending order of x.p, where p is a field of type Item of the objects in items.

Idiom #28 Sort by a property

Sort elements of array-like collection items in ascending order of x.p, where p is a field of type Item of the objects in items.

Code
Enum.sort(items, &(&1.p <= &2.p))
Doc URL
http://elixir-lang.org/docs/v1.0/elixir/Enum.html#sort/2
Demo URL
http://play.elixirbyexample.com/s/9ab4ff24fb