 
   @doc """
   Returns the first item for which `fun` returns a truthy value. If no such
-  item is found, returns `ifnone`.
+  item is found, returns `default`.
 
   ## Examples
 


  """
  @spec find(t, default, (element -> any)) :: element | default
  def find(collection, ifnone \\ nil, fun)

  def find(collection, ifnone, fun) when is_list(collection) do
    do_find(collection, ifnone, fun)
  end

  def find(collection, ifnone, fun) do
    Enumerable.reduce(collection, {:cont, ifnone}, fn(entry, ifnone) ->
      if fun.(entry), do: {:halt, entry}, else: {:cont, ifnone}
    end) |> elem(1)
  end



  """
  @spec find_value(t, any, (element -> any)) :: any | :nil
  def find_value(collection, default \\ nil, fun)

  def find_value(collection, default, fun) when is_list(collection) do
    do_find_value(collection, default, fun)
  end

  def find_value(collection, default, fun) do
    Enumerable.reduce(collection, {:cont, default}, fn(entry, default) ->
      fun_entry = fun.(entry)
      if fun_entry, do: {:halt, fun_entry}, else: {:cont, default}
    end) |> elem(1)
  end

