-
-
Notifications
You must be signed in to change notification settings - Fork 172
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
Add window
and window_2
to gleam/iterator
#692
Conversation
Hello! Could you detail what use cases you had for this? |
Hello too! Admittedly, my personal use cases are limited to solving mathematical puzzles. :D When working with infinite iterators, I kept running into the problem of needing the next n items, which ultimately led to |
Let's close this for now. This module is being deprecated anyway |
Interesting. Why would you want to deprecate the |
Because it's almost exclusively misused. No replacement is planned in the stdlib but the existing code will be published as a package. |
Would you mind elaborating on the misuse? Does the deprecation mean that there will be no way to have lazy/infinite sequences? |
Iterators introduce overhead over regular lists, so they are useful when working with collections that are too large to fit in memory where a plain list wouldn't be a good fit.
No, it will still be published as a standalone package (probably under |
@giacomocavalieri, thank you for your thorough clarification. I'm going to play devil's advocate here and say that I doubt that making When Rather than deprecating By simply moving the package elsewhere, you're not explaining why you felt the need to do so. Therefore, people will simply find wherever you moved it to and pull it in from elsewhere so they can continue to unknowingly misuse it because they never found a thorough explanation of misuse and better use to help them write better code. Another consideration would be to simply deprecate |
Making things harder to reach for by removing them from stdlib has worked all the other times we have done it, so I don't have any reason to think it would not work this time. |
I'd still advocate for adding documentation somewhere, along the lines of what @giacomocavalieri wrote above. Perhaps adding information to the soon-to-be-external |
Adds the equivalents of
list.window
andlist.window_by_2
to thegleam/iterator
package.