Making list from range fails: Enum.to_list(27..77//5)

It’s a special type of list called a charlist, a list of integers where all the integers are valid code points. The default inspect behavior is to represent such a list as the more “human readable” charlist. You can use the charlists: false option to inspect it as a list of integers.

iex(5)> '\e %*/49>CHM' |> IO.inspect(charlists: false) 
[27, 32, 37, 42, 47, 52, 57, 62, 67, 72, 77]

You can configure the shell to do this by default globally or for certain projects.

More reading:

https://elixir-lang.org/getting-started/binaries-strings-and-char-lists.html

5 Likes