Using quote() on a def in iex?

Why won’t iex output the ast?

1> quote do\
1> def hello(), do: 10\
1> end
$ iex
Erlang/OTP 20 [erts-9.3] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:10] [hipe] [kernel-poll:false]

Interactive Elixir (1.6.5) - press Ctrl+C to exit (type h() ENTER for help)
iex(1)> quote do
...(1)> def hello(), do: 10
...(1)> end
{:def, [context: Elixir, import: Kernel],
 [{:hello, [context: Elixir], []}, [do: 10]]}

Works for me…

1 Like

You don’t need to escape EOL like in a multi line bash command.

1 Like