On Wednesday, 7 September 2016 at 18:55:41 UTC, pineapple wrote:
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.)
Thanks for the reply. It looks like an interesting idea. You
might consider adding this (or a modified version) to a read me
in the range subfolder.
Are you familiar with Chapel at all? The language allows the user
to specify a domain with an array, facilitating sparsity or
arrays distributed across different machines. For some reason I
was reminded of that when you say that asrange returns a range
that enumerates the contents.