lazy thoughts

Brian Palmer d at brian.codekitchen.net
Mon Jan 12 11:26:04 PST 2009


Andrei Alexandrescu Wrote:

> (I originally emailed this to Walter and a couple others, but I thought 
> it might be better to gather insights from the community.)
> 
> I'm gearing up for changing std.algorithm, and I am thinking of making 
> the major change of favoring lazy evaluation throughout. (snip)

I am behind this change 100%. Awesome that range support enabled this functionality. I haven't used std.algorithm in a few months so I apologize if I'm out of date here, but you might want to start thinking about stream fusion too -- "fusing" multiple std.algorithm calls (map, fold, etc.) together so that you can pipeline computations and only ever allocate to get the final result.

Then with range support in streams, we could read in a stream, apply multiple transformations via std.algorithm, and then write to another stream all without extra allocation for intermediate results!



More information about the Digitalmars-d mailing list