0
iex(5)> Enum.map([{1, 2}, {3, 4}], fn({x, _y}) -> x end)   
[1, 3]

iex(6)> Enum.map([{40, 6}, {50, 12}], fn({x, _y}) -> x end)
'(2'

I tried the above code on the elixir interactive shell and had an unexpected output. I assume there's something wrong with the second code, Kindly advise.

st__gen_server
  • 597
  • 5
  • 9

1 Answers1

-2

In Elixir, you should remember about codepoints and how Kernel works.

When you check your codes:

iex> List.to_string([50])
"2"
iex> List.to_string([40])
"("