Brian Palmer wrote:
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!

Good point. Yes, the overhaul of std.algorithm in wake of streams will be accompanied by an overhaul of std.stdio (work on files as streams), std.random (random generators as streams), std.format (output formatted objects straight to streams) and probably a couple of others.

Andrei

Reply via email to