"lazy iterators"

If some random woman stops you in the street and postulates that "map() is lazy!" and then walks away as mysteriously as she entered your life, what does she actually, technically, mean? Is it just another way of saying "consumes an iterator and returns an iterator"?

Update: She returned and muttered "adapter pattern". I am enlightened!

Update 2: I hadn't previously read through the entire documentation for std::iter, which I clearly should have.

1 Like

Is that woman's name rustc...?

Iterator::map is lazy. Option::map is non-lazy (aka "eager").
To see the differences between eager and lazy, see this playground:

1 Like

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.