Blog Post: Taking Control of Map Sort Order in Elixir

OTP 26 was released and the Elixir 1.14.4 builds have been updated! Erlang OTP 26 changed how map keys are sorted, or not sorted actually. Check out this quick tip on how to customize IEx to always sort the map keys with your local development!


This is great, and I love that you shared your personal ~/.iex.exs, definitely gives me some ideas!

I’ll add that I’m also a big fan of defaulting to always printing charlists as lists of numbers:

  inspect: [
    charlists: :as_lists

This prevents the common confusion of wondering why the list of integers you were operating on suddenly renders as text.


Great post, is there a way to do this for tests too?

Currently I am doing something like

if :erlang.system_info(:otp_release) >= '26' do

But that’s ugly.

1 Like