File tree Expand file tree Collapse file tree 1 file changed +17
-17
lines changed Expand file tree Collapse file tree 1 file changed +17
-17
lines changed Original file line number Diff line number Diff line change @@ -1057,23 +1057,6 @@ defmodule Enum do
1057
1057
end
1058
1058
end
1059
1059
1060
- @ doc """
1061
- Returns the collection with each element wrapped in a tuple
1062
- along side its index.
1063
-
1064
- ## Examples
1065
-
1066
- iex> Enum.with_index [1,2,3]
1067
- [{1,0},{2,1},{3,2}]
1068
-
1069
- """
1070
- @ spec with_index ( t ) :: list ( { element , non_neg_integer } )
1071
- def with_index ( collection ) do
1072
- map_reduce ( collection , 0 , fn x , acc ->
1073
- { { x , acc } , acc + 1 }
1074
- end ) |> elem ( 0 )
1075
- end
1076
-
1077
1060
@ doc """
1078
1061
Returns the maximum value.
1079
1062
Raises empty error in case the collection is empty.
@@ -1192,6 +1175,23 @@ defmodule Enum do
1192
1175
end
1193
1176
end
1194
1177
1178
+ @ doc """
1179
+ Returns the collection with each element wrapped in a tuple
1180
+ along side its index.
1181
+
1182
+ ## Examples
1183
+
1184
+ iex> Enum.with_index [1,2,3]
1185
+ [{1,0},{2,1},{3,2}]
1186
+
1187
+ """
1188
+ @ spec with_index ( t ) :: list ( { element , non_neg_integer } )
1189
+ def with_index ( collection ) do
1190
+ map_reduce ( collection , 0 , fn x , acc ->
1191
+ { { x , acc } , acc + 1 }
1192
+ end ) |> elem ( 0 )
1193
+ end
1194
+
1195
1195
## Helpers
1196
1196
1197
1197
defp iterate_and_count ( collection , count ) do
You can’t perform that action at this time.
0 commit comments