foreach thoughts

Tobias Pankrath tobias at pankrath.net
Tue Jan 14 02:09:29 PST 2014


On Tuesday, 14 January 2014 at 09:55:42 UTC, bearophile wrote:
> As D programs use more and more algorithm UFCS chains, D 
> compilers will need to optimize that kind of code better, 
> adding specific high-level and mid-level optimizations (rewrite 
> rules, deforestations, etc).

You came up with deforestation several times now, so I digged up 
this paper from wikipedia 
http://homepages.inf.ed.ac.uk/wadler/papers/deforest/deforest.ps

I skimmed it and it seems that the advantage is elimination of 
intermediate data structures (i.e. lists), which is std.algorithm 
achieves by design. Could you elaborate how deforestation might 
apply to std.algorithm?



More information about the Digitalmars-d mailing list