Elixir [40, 60, 80] printed as '(<P'

55 views Asked by At

I did a fresh install of Elixir/Erlang on a current Ubuntu flavor (pop_os!).

I hopped into iex, and tried the following code with responses:

iex(1)> Enum.map([2, 3, 4], fn x -> x * 10 end)
[20, 30, 40]
iex(2)> Enum.map([4, 6, 8], fn x -> x * 10 end)
'(<P'

Obviously '(<P' is not an array of 3 numbers.

At first, I figured it was a bad install of Elixir/Erlang, so I uninstalled, changed repositories, and tried again, and got the same response. (One was 1.15, the second 1.12).

Does anyone recognize this isue and know its cause?

Update: I was going nuts trying to find a solution, but it looks like this is a language bug of some kind? Giving up on my environment, setup, and iex, I tried instead going to:

https://www.tutorialspoint.com/execute_elixir_online.php

And ran the code:

a = Enum.map([2, 3, 4], fn x -> x * 10 end)
b = Enum.map([4, 6, 8], fn x -> x * 10 end)
IO.puts "Program Start"
IO.inspect a
IO.inspect b
IO.puts "Program End"

which gave the response

Program Start
[20, 30, 40]
'(<P'
Program End

This makes me suspect it's either there's a problem with my the formatting of my Enum.map calls that I'm missing, or there's a bug in Elixir.

0

There are 0 answers