Elixir returns question marks instead of function result

Hi guys!
I have simple code snippet here: defmodule Xdd do def reverse_without_duplicates(list) do list |> - Pastebin.com If I run that in terminal I get ??? (question marks) in squares. In iex I get correct output. What am I doing wrong?

IO.puts tries to print its input as char list. So it will write the bytes 10, 1, 3, 2 which are a carriage return, and 3 other command characters I do not know consciously and had to look up in an ASCII table.

If you want to see the value, you probably want to use IO.inspect/1 instead.


Just to add to @Nobbz’s answer: the reason you see what you expected in iex is because iex calls inspect/1 on the return from any function you execute. So iex is doing largely what @Nobbz is suggesting you do.

You’ll probably find yourself using IO.inspect/1 during debugging since it will output and inspection format of its parameter and then return the parameter. This makes it very useful for inserting in pipelines.