Skip to content
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

Merged
merged 2 commits into from
Jul 2, 2024
Merged

Conversation

vanderhoop
Copy link
Contributor

@vanderhoop vanderhoop commented Jun 16, 2024

  • fixes broken language in top-level description
  • unifies the backticking in the docs 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

- 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
@@ -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.
Copy link
Member

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). :)

lib/elixir/lib/enum.ex Outdated Show resolved Hide resolved
@josevalim josevalim merged commit 2d1f280 into elixir-lang:main Jul 2, 2024
9 checks passed
@josevalim
Copy link
Member

💚 💙 💜 💛 ❤️

Comment on lines +3852 to +3855
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
Copy link
Contributor

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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants