On Wednesday, 7 September 2016 at 18:22:39 UTC, jmh530 wrote:
On Wednesday, 7 September 2016 at 18:10:45 UTC, pineapple wrote:
You might want to check out the ranges package of the library
I'm working on.
https://github.com/pineapplemachine/mach.d/tree/master/mach/range
There's a lot of stuff there. Do you mind giving a TL;DR
version of what your range library does differently than phobos?
So the first difference you're likely to notice is that it's not
as well documented. (Sorry. I'm a busy woman. I'll get around to
it.) I try to make up for it with copious unit tests, which
should provide a good example for how to use any given module.
In terms of functionality, the single-biggest difference is that
unlike phobos I don't treat arrays or any other collection
directly as ranges; instead types may provide an `asrange`
property returning a range that enumerates their contents. This
architecture allows you to express HOFs as shown in that prior
post, not having to worry about whether it's safe to treat the
array itself as a range or whether you have to slice it.
Other significant differences include not requiring
bidirectional, slicing, random-access ranges to also be saving
("forward") ranges; (for the most part) supporting immutable
elements in ranges; and a more clearly defined interface for what
insertion and removal operations you may perform upon a range and
how they are expected to behave. There are a few things phobos
provides that I don't yet, but there's also a handful of things
implemented in mach.range that aren't in phobos. (My personal
favorite example of such is its small suite of PRNG
implementations.)
Also: I just pushed the fix.