Skip to content

Commit 1a855ae

Browse files
Add minor clarifications for Enum.{flap_map/2, flat_map_reduce/3} (#14711)
1 parent 03522aa commit 1a855ae

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

lib/elixir/lib/enum.ex

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1214,7 +1214,7 @@ defmodule Enum do
12141214
end
12151215

12161216
@doc """
1217-
Maps the given `fun` over `enumerable` and flattens the result.
1217+
Maps the given `fun` over `enumerable` and flattens the result only one level deep.
12181218
12191219
This function returns a new enumerable built by appending the result of invoking `fun`
12201220
on each element of `enumerable` together; conceptually, this is similar to a
@@ -1262,13 +1262,16 @@ defmodule Enum do
12621262
defp flat_reverse([], acc), do: acc
12631263

12641264
@doc """
1265-
Maps and reduces an `enumerable`, flattening the given results (only one level deep).
1265+
Maps and reduces an `enumerable`, flattening the results only one level deep.
12661266
12671267
It expects an accumulator and a function that receives each enumerable
12681268
element, and must return a tuple containing a new enumerable (often a list)
12691269
with the new accumulator or a tuple with `:halt` as first element and
12701270
the accumulator as second.
12711271
1272+
Returns a 2-element tuple where the first element is the results flattened one level deep and
1273+
the second element is the last accumulator.
1274+
12721275
## Examples
12731276
12741277
iex> enumerable = 1..100

0 commit comments

Comments
 (0)