== Quote from Simen Kjaeraas ([email protected])'s article > dsimcha wrote: > > RangeExtra version 10^-20 is officially out. It consists of a small and > > hopefully growing number of ranges that didn't make it into the new > > Phobos > > that I've gotten working reasonably well and I feel eventually belong in > > Phobos. > > > > Docs / What's there: > > http://cis.jhu.edu/~dsimcha/rangeextra.html > > > > Code: > > http://dsource.org/projects/scrapple/browser/trunk/rangeextra/rangeextra.d > > > > License: > > Dual licensed, Phobos license or BSD (Tango style). > I had hoped reindex would give me access to true 'random' access ranges, but > it seems this does not work: > auto b = reindex!( "uniform( 0, this.length )" )( [0,1,2,3,4].dup ); > :p
Very cool idea. Nothing like what I had in mind as a use case for Reindex, but half the fun of generic programming is seeing stuff get used for things you hadn't anticipated. I spent some time trying, and for some reason I can't for the life of me get this example to work, or even the one where the length is hard-coded. It may be some obscure compiler bug, because I'm just getting weird inscrutable error messages and I can't really figure out where they're coming from. On the other hand, I really like the idea of a with-replacement random sampling primitive. This sounds like it belongs in RandomCover. Maybe Andrei can extend RandomCover (which already samples w/o replacement) to include a replacement parameter. RandomCover w/ replacement == false would do what it does now. If replacement == true, it would be an infinite range that samples with replacement.
