tupleops 0.0.3

typecons operations


To use this package, put the following dependency into your project's dependencies section:

dub.json
dub.sdl

tupleops

Build Status codecov Dub version

Tuple operations for D language

unittest
{
    import std.conv : to;
    alias f = overload!(
        (int i) => i.to!string,
        (int i, int j) => i + j,
        (double d) => d * 2);

    static assert(f(1, -2) == -1);
    static assert(f(1.0) == 2.0);
    static assert(f(1) == "1");

    // apply longest argument overload
    enum t1 = tuple(1.0, 2, tuple(3, 4));
    static assert(map!f(t1)  == tuple(2.0, "2", 7));

    enum t2 = tuple(1.0, 2, tuple(3.0, tuple(tuple(4, 5), 6), 7.0));
    static assert(map!f(t2)  == tuple(2.0, "2", tuple(6.0, tuple(9, "6"), 14.0)));
}
  • map
  • depthFirstFlatMap (used for flatten)
  • breadthFirstFlatMap
  • overload (useful for map functions)
  • flatten
  • ptrs
  • unzip
Authors:
  • Shigeki Karita
Dependencies:
none
Versions:
0.0.4 2018-Nov-17
0.0.3 2018-Nov-17
0.0.2 2018-Nov-16
0.0.1 2018-Nov-15
~master 2018-Dec-11
Show all 5 versions
Download Stats:
  • 0 downloads today

  • 0 downloads this week

  • 0 downloads this month

  • 2 downloads total

Score:
0.4
Short URL:
tupleops.dub.pm