Powered by AppSignal & Oban Pro
Would you like to see your link here? Contact us
Notesclub

Untitled notebook

features10.livemd

Untitled notebook

Section

defmodule Fib do
  @doc ~S"""
    Calculate Fibonacci

    ## Examples
      iex> Fib.fib(0)
      0

      iex> Fib.fib(1)
      1

      iex> Fib.fib(2)
      1

      iex> Fib.fib(3)
      2
  """

  def fib(0), do: 0
  def fib(1), do: 1

  def fib(n) do
    Process.sleep(:timer.seconds(1))
    fib(n - 1) + fib(n - 2)
  end
end
R = 3,
S = 1,

Add = fun(A,B) -> A + B end,

Add(R,S).
binding()
add.(r, s)