#is there a way to obtain the full call stack of a function?, and pattern match it?

2 messages · Page 1 of 1 (latest)

drifting sage
#

Example

defmodule BankAcount do
  def f1() do
    :rand.uniform(9) + 1
  end

  def f2(), do: f1()
  def f3(), do: f1()

  def f4() do
    number = :rand.uniform(9) + 1
    case rem(number, 2) do
      0 -> f2()
      _ -> f3()
    end
  end

  def main() do
      # How to get the function callstack and pattern match it?
      f4()
  end
end

BankAcount.main()
fierce olive
#

Please do not duplicate your questions to multiple channels