-
StackOverflow 文件
-
Elixir Language 教程
-
除錯技巧
-
撬管
defmodule Demo do
def foo do
1..10
|> Enum.map(&(&1 * &1))
|> Enum.filter(&rem(&1, 2) == 0) |> pry
|> Enum.take(3)
end
defp pry(e) do
require IEx
IEx.pry
e
end
end
iex(1)> Demo.foo
Request to pry #PID<0.117.0> at lib/demo.ex:11
def pry(e) do
require IEx
IEx.pry
e
end
Allow? [Yn] Y
Interactive Elixir (1.3.2) - press Ctrl+C to exit (type h() ENTER for help)
pry(1)> e
[4, 16, 36, 64, 100]
pry(2)> respawn
Interactive Elixir (1.3.2) - press Ctrl+C to exit (type h() ENTER for help)
[4, 16, 36]
iex(1)>