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