Hash :
5e3b4436
Author :
Thomas de Grivel
Date :
2022-02-03T12:22:50
defmodule Stack do
def to_string(stack), do: to_string(stack, [])
def to_string([], acc), do: acc |> Enum.reverse() |> Enum.join("\n")
def to_string([{module, fun, arity, [file: file, line: line]} | rest], acc) do
str = "#{module}.#{fun}/#{arity} in #{file}:#{line}"
to_string(rest, [str | acc])
end
def to_string([{module, fun, arity, _} | rest], acc) do
str = "#{module}.#{fun}/#{arity}"
to_string(rest, [str | acc])
end
def to_string([elt | rest], acc) do
to_string(rest, [inspect(elt) | acc])
end
end