Mir Algorithm v0.5.16: @safe ndslice; shortcuts; topology.pairwise instead of isSorted and isStrictlyMonotonic

9il via Digitalmars-d-announce digitalmars-d-announce at puremagic.com
Sun May 14 18:55:40 PDT 2017


On Sunday, 14 May 2017 at 17:29:44 UTC, jmh530 wrote:
> On Saturday, 13 May 2017 at 08:10:20 UTC, 9il wrote:
>> https://github.com/libmir/mir-algorithm/releases/tag/v0.5.16
>
> The documentation for mir.functional might need an update based 
> on the refTuple change. The links at the top are missing 
> refTuple and RefTuple. tuple doesn't go anywhere, also ref 
> doesn't either.

Thanks, fixed.

> I didn't really realize these were in there. How does it 
> compare to std.typecons.Tuple? I was thinking about doing some 
> work with std.typecons.Tuple's that hold mir.slices and not 
> sure if I should use RefTuple instead.

1. RefTuple can hold pointers instead of values. For example 
Mir's zip, cartesian use RefTuples. This makes zip faster and 
more flexible, because it is partially mutable compared with 
Tuple.

2. Ndslice composed of RefTuples has special syntax with Map, for 
example "a + b" instead of "a[0] + a[0]" .

3. RefTuple does not ha ` [0]` syntax or other names then `a`, 
`b`, `c`.

4. RefTuple is faster to compile, though

Example:

auto s = zip(mask, b, c).map!"a ? b : c";

Loads either a or b.


More information about the Digitalmars-d-announce mailing list