Unexpected Keyword.merge behavior (elixir 1.9.4)

Hello and welcome,

It’s the charlist challenge, once You understand this, You can go to the next level :slight_smile:

iex> [65, 66, 67]
'ABC'
iex> [65, 66, 67, 0]
[65, 66, 67, 0]
iex> [7]
'\a'
iex> [7] == '\a'
true

Charlist are just list of codepoints, if Elixir receive a list of integers, it will try to print it as readable characters, if not, it will print the list. In case You want to inspect…

iex> IO.inspect [65, 66, 67], charlists: :as_lists
[65, 66, 67]
iex> IO.inspect [65, 66, 67], charlists: :as_charlists
'ABC'
6 Likes