Enum—Processing Collections

The Enum module is probably the most used of all the Elixir libraries. Employ it to iterate, filter, combine, split, and otherwise manipulate collections. Here are some common tasks:

A Note on Sorting

In our example of sort, we used

 iex>​ Enum.sort [​"​​there"​, ​"​​was"​, ​"​​a"​, ​"​​crooked"​, ​"​​man"​],
 ...>​ &(String.length(&1) <= String.length(&2))

It’s important to use <= and not just < if you want the sort to be stable.