-
Notifications
You must be signed in to change notification settings - Fork 3.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve Enum.with_index/2
docs
#13671
Conversation
- fixes broken language in top-level description - unifies the snippet syntax to apply to the `offset` argument - previously, the argument name was surrounded by backticks in the first example, while the second example had the type surrounded in backticks
lib/elixir/lib/enum.ex
Outdated
@@ -3847,14 +3847,12 @@ defmodule Enum do | |||
|
|||
@doc """ | |||
Returns the `enumerable` with each element wrapped in a tuple | |||
alongside its index or according to a given function. | |||
alongside its index. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should still mention the function in the summary (first line). :)
💚 💙 💜 💛 ❤️ |
If an `offset` integer is given, it will index from the given offset instead of from | ||
zero. | ||
|
||
If a `function` is given, it will index by invoking the function for each | ||
If an `offset` function is given, it will index by invoking the function for each |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given that the name of the documented arg is fun_or_offset
, this feels a bit confusing (especially since the function is not an offset)
offset
argument