map! evaluates twice

Ali Çehreli acehreli at yahoo.com
Fri Jun 10 22:10:10 UTC 2022


On 6/10/22 13:47, Steven Schveighoffer wrote:

 > `map` calls the lambda for each call to `front`. If you want a cached
 > version, use `cache`:

Others don't know but as I will likely show during a lightning talk at 
DConf, I am trying to finish a .cached range algorithm that caches all 
elements that are in use. (It must drop old elements so that an infinite 
range does not require infinite cache.)

It is supposed to evaluate elements only once.

Ali



More information about the Digitalmars-d-learn mailing list