On 07/11/2010 08:34 PM, dsimcha wrote:
1. What happens if you run out of space in the input range variety? I guess it throws?
It's up to the range. Most will throw.
2. Would there be a "standard" way of signaling how much stuff was written to the input range variety? I guess that since functions that output their results via output ranges would usually return void, they could return an integer instead indicating how much stuff was written.
There is no standard way at the moment. I think not throwing implies all passed data has been written.
3. While we're on the subject of improving output ranges, I was just thinking before I read your post that it would be nice to have a Tee type in std.range, since outputting to exactly one output range is kind of inflexible. Such a type would itself be an output range. It would take in N output ranges where N> 1 as instantiation parameters, and pass any input received to all of the underlying ranges.
Yah, tee would be great.
The use case I thought of for this is when I'm generating tons of data through a monte carlo simulation and don't want to store it all in memory. Both Summary in dstats and Histogram in dflplot can be used as output ranges. I'd love to write a function that outputs results to an output range and use Tee to get both summary statistics and a histogram.
... and checkpoint all that to a file. Andrei
