Skip to content

Commit 88326e7

Browse files
albertoalmagrojosevalim
authored andcommitted
Name enumerable consistently (#7115)
The whole Enum module uses `enumerable` to name enumerables, but a few places used `enum`. This commit names all occurrences consistently.
1 parent ecacaa5 commit 88326e7

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

lib/elixir/lib/enum.ex

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ defprotocol Enumerable do
1515
1616
Internally, `Enum.map/2` is implemented as follows:
1717
18-
def map(enum, fun) do
18+
def map(enumerable, fun) do
1919
reducer = fn x, acc -> {:cont, [fun.(x) | acc]} end
20-
Enumerable.reduce(enum, {:cont, []}, reducer) |> elem(1) |> :lists.reverse()
20+
Enumerable.reduce(enumerable, {:cont, []}, reducer) |> elem(1) |> :lists.reverse()
2121
end
2222
2323
Notice the user-supplied function is wrapped into a `t:reducer/0` function.
@@ -420,7 +420,7 @@ defmodule Enum do
420420
end
421421

422422
@doc """
423-
Chunks the `enum` with fine grained control when every chunk is emitted.
423+
Chunks the `enumerable` with fine grained control when every chunk is emitted.
424424
425425
`chunk_fun` receives the current element and the accumulator and
426426
must return `{:cont, element, acc}` to emit the given chunk and
@@ -456,9 +456,9 @@ defmodule Enum do
456456
(acc -> {:cont, chunk, acc} | {:cont, acc})
457457
) :: Enumerable.t()
458458
when chunk: any
459-
def chunk_while(enum, acc, chunk_fun, after_fun) do
459+
def chunk_while(enumerable, acc, chunk_fun, after_fun) do
460460
{_, {res, acc}} =
461-
Enumerable.reduce(enum, {:cont, {[], acc}}, fn entry, {buffer, acc} ->
461+
Enumerable.reduce(enumerable, {:cont, {[], acc}}, fn entry, {buffer, acc} ->
462462
case chunk_fun.(entry, acc) do
463463
{:cont, emit, acc} -> {:cont, {[emit | buffer], acc}}
464464
{:cont, acc} -> {:cont, {buffer, acc}}
@@ -1024,9 +1024,9 @@ defmodule Enum do
10241024
10251025
## Examples
10261026
1027-
iex> enum = 1..100
1027+
iex> enumerable = 1..100
10281028
iex> n = 3
1029-
iex> Enum.flat_map_reduce(enum, 0, fn i, acc ->
1029+
iex> Enum.flat_map_reduce(enumerable, 0, fn i, acc ->
10301030
...> if acc < n, do: {[i], acc + 1}, else: {:halt, acc}
10311031
...> end)
10321032
{[1, 2, 3], 3}

0 commit comments

Comments
 (0)