I'm working on the new range stuff and the range-based algorithm. In all likelihood, you all might be pleased with the results.

I wanted to gauge opinions on a couple of issues. One is, should the empty() member function for ranges be const? On the face of it it should, but I don't want that to be a hindrance. I presume non-const empty might be necessary sometimes, e.g. figuring out if a stream is empty effectively means fetching an element off it.

Second, there are arguably some range-related constructs that do not really qualify as "algorithms" (some of these are inspired from Haskell's standard library):

1. repeat(x) => returns an infinite range consisting of the element x repeated.

http://www.zvon.org/other/haskell/Outputprelude/repeat_f.html

2. take(n, range) => takes at most n elements out of a range (very useful with infinite ranges!)

http://www.zvon.org/other/haskell/Outputprelude/take_f.html

3. cycle(range)

http://www.zvon.org/other/haskell/Outputprelude/cycle_f.html

and a few others. I defined a new module called std.range that contains range fundamentals. Should I put these functions in there, or in std.algorithm? Or should I just merge them both to avoid confusion? If not, where to I draw the line between "it's an algorithm" and "it's a range utility"?


Thanks,

Andrei

Reply via email to