On 06/12/14 00:58, bearophile via Digitalmars-d-learn wrote:
Joseph Rushton Wakeling:

Can anyone advise why,

map is lazy, like most other ranges.

Ah, I see. That function would only be called on consumption of the results of the map.

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

Yes, I did wonder about that. I'll post up the actual code tomorrow -- I was having some fun playing with one of the metrics in my Dgraph library and trying to see to what extent I could simplify it (reading-wise) with a range-based approach.

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.

Yes, I remember you requesting that.  Were there ever any PRs, or was it just 
spec?

Reply via email to