 
     formatted_clauses =
       if clauses do
+        format_clause_fun = fn {args, guards} ->
+          code = Enum.reduce(guards, {function, [], args}, &{:when, [], [&2, &1]})
+          "    #{kind} " <> Macro.to_string(code, ast_fun) <> "\n"
+        end
+
         top_10 =
           clauses
           |> Enum.take(10)
-          |> Enum.map(fn {args, guards} ->
-            code = Enum.reduce(guards, {function, [], args}, &{:when, [], [&2, &1]})
-            "    #{kind} " <> Macro.to_string(code, ast_fun) <> "\n"
-          end)
-
-        "\nAttempted function clauses (showing #{length(top_10)} out of #{length(clauses)}):\n\n#{top_10}"
+          |> Enum.map(format_clause_fun)
+
+        "\nAttempted function clauses (showing #{length(top_10)} out of #{length(clauses)}):" <>
+          "\n\n#{top_10}"
       else
         ""
       end

  not return the stacktrace corresponding to the exception
  an empty stacktrace, `[]`, must be used.
  """
  @spec format_banner(kind, any, stacktrace | nil) :: String.t
  def format_banner(kind, exception, stacktrace \\ nil)

  def format_banner(:error, exception, stacktrace) do


  # If value is a list will be formatted by mfa exit in format_exit/1
  defp format_exit_reason({:bad_return, {mod, :init, value}})
       when is_atom(mod) do
    format_mfa(mod, :init, 1) <> " returned a bad value: " <> inspect(value)
  end

