Description
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.