Iex not converting keyword list

Inside iex

[ name: “Dave”, city: “Dallas”, likes: “Programming” ]

is not converted to

[ {:name, “Dave”}, {:city, “Dallas”}, {:likes, “Programming”} ]

in iex but to

[ name: “Dave”, city: “Dallas”, likes: “Programming” ]

instead

The two are equivalent. The first is just a “shorthand” syntax for keyword lists.

1 Like

Oh I thought IEX will show the second one as output.

iex(1)> data = [name: "Dave", city: "Dallas", likes: "Programming"]
[name: "Dave", city: "Dallas", likes: "Programming"]
iex(2)> :io.fwrite("~w", [data])
[{name,<<68,97,118,101>>},{city,<<68,97,108,108,97,115>>},{likes,<<80,114,111,103,114,97,109,109,105,110,103>>}]:ok
iex(3)> 

Keyword — Elixir v1.16.0

3 Likes