You need to do it like this:
defmodule A do
def f(a, b \\ [])
def f(a, []), do: "f(#{inspect(a)})"
def f(a, b) when is_list(b), do: "f(#{inspect(a)}, #{inspect(b)})"
end
IO.puts A.f(5)
# Output --> f(5)
IO.puts A.f(5, [:one, :two])
# Output --> f(5, [:one, :two])






















