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

Mention single-element ranges in range definition #10868

Conversation

eksperimental
Copy link
Contributor

@eksperimental eksperimental commented Apr 3, 2021

It is kind of confusing to think of single-element ranges either as increasing and decreasing as per the previous definition.

It got me thinking when 5..5//1 had one element, why 5..5//-1 had one element too.

@eksperimental
Copy link
Contributor Author

eksperimental commented Apr 3, 2021

I am also using this format in the examples,
iex> 5..5//1 |> Enum.to_list()

as I think it is visually easier to identify to show the range which is what matters as the beginning of the line.

But I would like to change the format for the examples above as well.

@josevalim
Copy link
Member

I will add more examples later but the current definition makes it clear one range elements are supported given there is at least one element where that is between first and last. Thank you.

@josevalim josevalim closed this Apr 3, 2021
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.

2 participants