Enum.sort_by(records, fn(r) -> {r[:age], r[:name]} end, &>=/2)
Tuples, when compared with one another, are ordered according to what appears first in the tuple. So in this case it would sort by age first, then by name. Doing it by different directions for each though is a bit harder.