Joseph Rushton Wakeling:

Can anyone advise why,

map is lazy, like most other ranges.


and whether there's a nice range iteration option to ensure that this function gets called using each element of the filteredRange?

Lazy higher order functions like map/filter should be used only with pure functions. There are bugs/troubles in using them on impure code.

There was a proposal for a "each" function to terminate a range chain with something effectful, but I think it has gone nowhere. This means you have to use a foreach on a range.

Bye,
bearophile

Reply via email to