@@ -37,13 +37,13 @@ defprotocol Enumerable do
37
37
def reduce ( collection , acc , fun )
38
38
39
39
@ doc """
40
- The function is used to check if a value exists within the collection.
40
+ This function is used to check if a value exists within the collection.
41
41
Membership should be tested with the match (`===`) operator.
42
42
"""
43
43
def member? ( collection , value )
44
44
45
45
@ doc """
46
- The function is used to retrieve the collection's size.
46
+ This function is used to retrieve the collection's size.
47
47
"""
48
48
def count ( collection )
49
49
end
@@ -67,12 +67,12 @@ defmodule Enum do
67
67
68
68
Note the functions in the `Enum` module are eager: they always start
69
69
the enumeration of the given collection. The `Stream` module allows
70
- lazy enumeration of collections and also provides infinite streams.
70
+ lazy enumeration of collections and provides infinite streams.
71
71
72
72
Since the majority of the functions in `Enum` enumerate the whole
73
73
collection and return a list as result, infinite streams need to
74
74
be carefully used with such functions, as they can potentially run
75
- forever, for example:
75
+ forever. For example:
76
76
77
77
Enum.each Stream.cycle([1,2,3]), &IO.puts(&1)
78
78
@@ -88,7 +88,7 @@ defmodule Enum do
88
88
@ doc """
89
89
Checks if `value` exists within the `collection`.
90
90
91
- Membership is tested with the match (`===`) operator although
91
+ Membership is tested with the match (`===`) operator, although
92
92
enumerables like ranges may include floats inside the given
93
93
range.
94
94
@@ -256,7 +256,7 @@ defmodule Enum do
256
256
@ doc """
257
257
Concatenates the enumerable on the right with the enumerable on the left.
258
258
259
- This function produces the same result the `++` operator for lists.
259
+ This function produces the same result as the `++` operator for lists.
260
260
261
261
## Examples
262
262
@@ -285,7 +285,7 @@ defmodule Enum do
285
285
@ doc """
286
286
Drops the first `count` items from `collection`.
287
287
288
- If a negative value `count` is given the last `count`
288
+ If a negative value `count` is given, the last `count`
289
289
values will be dropped. The collection is enumerated
290
290
once to retrieve the proper index and the remaining
291
291
calculation is performed from the end.
@@ -906,7 +906,7 @@ defmodule Enum do
906
906
Notice you need to explicitly call `:random.seed/1` and
907
907
set a seed value for the random algorithm. Otherwise, the
908
908
default seed will be set which will always return the same
909
- result. For example, one could the following to set a seed
909
+ result. For example, one could do the following to set a seed
910
910
dynamically:
911
911
912
912
:random.seed(:erlang.now)
@@ -973,7 +973,7 @@ defmodule Enum do
973
973
collection.
974
974
975
975
Be aware that a negative `count` implies the collection
976
- will be enumerated twice. Once to calculate the position and
976
+ will be enumerated twice: once to calculate the position, and
977
977
a second time to do the actual splitting.
978
978
979
979
## Examples
@@ -1039,9 +1039,9 @@ defmodule Enum do
1039
1039
@ doc """
1040
1040
Takes the first `count` items from the collection.
1041
1041
1042
- If a negative value `count` is given the last `count`
1042
+ If a negative value `count` is given, the last `count`
1043
1043
values will be taken. The collection is enumerated
1044
- once to retrieve the proper index and the remaining
1044
+ once to retrieve the proper index. The remaining
1045
1045
calculation is performed from the end.
1046
1046
1047
1047
## Examples
@@ -1155,7 +1155,7 @@ defmodule Enum do
1155
1155
end
1156
1156
1157
1157
@ doc """
1158
- Iterates the enumerable removing all duplicated items.
1158
+ Iterates the enumerable, removing all duplicated items.
1159
1159
1160
1160
## Examples
1161
1161
@@ -1330,7 +1330,7 @@ defmodule Enum do
1330
1330
1331
1331
@ doc """
1332
1332
Returns the collection with each element wrapped in a tuple
1333
- along side its index.
1333
+ alongside its index.
1334
1334
1335
1335
## Examples
1336
1336
@@ -1354,7 +1354,7 @@ defmodule Enum do
1354
1354
@ doc """
1355
1355
Returns a collection of lists containing `n` items each, where
1356
1356
each new chunk starts `step` elements into the collection.
1357
- `step` is optional and if not passed, defaults to `n`, i.e.
1357
+ `step` is optional and, if not passed, defaults to `n`, i.e.
1358
1358
chunks do not overlap. If the final chunk does not have `n`
1359
1359
elements to fill the chunk, elements are taken as necessary
1360
1360
from `pad` if it was passed. If `pad` is passed and does not
@@ -1425,8 +1425,8 @@ defmodule Enum do
1425
1425
end
1426
1426
1427
1427
@ doc """
1428
- Returns a subset list of the given collection. Dropping elements
1429
- until element position `start`, then taking `count` elements.
1428
+ Returns a subset list of the given collection. Drops elements
1429
+ until element position `start`, then takes `count` elements.
1430
1430
1431
1431
## Examples
1432
1432
@@ -1470,8 +1470,8 @@ defmodule Enum do
1470
1470
end
1471
1471
1472
1472
@ doc """
1473
- Returns a subset list of the given collection. Dropping elements
1474
- until element position `range.first`, then taking elements until element
1473
+ Returns a subset list of the given collection. Drops elements
1474
+ until element position `range.first`, then takes elements until element
1475
1475
position `range.last` (inclusive).
1476
1476
1477
1477
Positions are calculated by adding the number of items in the collection to
0 commit comments