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 that combinators are lazy #202

Open
illicitonion opened this issue Oct 31, 2024 · 0 comments
Open

Mention that combinators are lazy #202

illicitonion opened this issue Oct 31, 2024 · 0 comments

Comments

@illicitonion
Copy link
Contributor

https://rust-exercises.com/100-exercises/06_ticket_management/07_combinators introduces filter, map and friends.

I think it's probably worth explicitly mentioning that these are lazy operations, and what this means. Coming from a language like JavaScript where there isn't a similar concept of laziness (e.g. Array.prototype.filter eagerly returns a new Array). Emphasising both that map doesn't instantly run (and shouldn't be relied on for side-effects!), and that an iterator can be collected into different collections (maybe showing an example of collecting into a BTreeSet or similar - right now the collect section hints at this, but I suspect isn't as explicit as it could be) would help clarify this, as well as making the power of these combinators more clear.

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

No branches or pull requests

1 participant