     do_partition(pointer, iterator, fun, [], [])
   end
 
-  # Iterates the collection passing an accumulator as parameter.
-  # Returns the accumulator.
-  #
-  # ## Examples
-  #
-  #     Enum.reduce [1, 2, 3], 0, fn(x, acc, do: x + acc)
-  #     #=> 6
-  #
+  @doc """
+  Iterates the collection passing an accumulator as parameter.
+  Returns the accumulator.
+
+  ## Examples
+
+      Enum.reduce [1, 2, 3], 0, fn(x, acc, do: x + acc)
+      #=> 6
+
+  """
   def reduce(collection, acc, f) when is_list(collection) do
     :lists.foldl(f, acc, collection)
   end

    do_filter(pointer, iterator, fun)
  end

  # Filters the collection and maps its values in one pass.
  #
  # ## Examples
  #
  #     Enum.filter_map [1, 2, 3], fn(x, do: rem(x, 2) == 0), &1 * 2
  #     #=> [4]

  def filter_map(collection, filter, mapper) do
    { iterator, pointer } = I.iterator(collection)
    filter_map(iterator, pointer, filter, mapper)

    times
  end

  @doc """
  Iterates the given function n times, passing values from 1
  to n. Also has an accumulator similar to fold to store the
  value between computations.

  ## Examples

     Enum.times 5, 0, fn(x, acc, do: acc + x)
     #=> 15

  """
  def times(times, acc, function) when times >= 0 do
    do_times_2(times, 1, function, acc)
  end
