ddash 0.24.0

Utility library for D

To use this package, run the following command in your project's root directory:

Manual usage
Put the following dependency into your project's dependences section:


Latest version Build Status codecov license

Full API docs available here

A utility library that was inspired by the a javascript library called lodash. The algorithms operate on sequences that are either:

  • value sequences:
    assert(1.concat(2, 3, 4).array == [1, 2, 3, 4]);
  • ranges:
    assert(1.concat([2, 3, 4]).array == [1, 2, 3, 4]);
  • a mixture of the above two:
    assert(1.concat([2, 3], 4).array == [1, 2, 3, 4]);
  • associative arrays:
    auto aa = ["a": 1, "b": 0, "c": 2];
    assert(aa.compactValues!(a => a == 0) == ["a": 1, "c": 2]);

Furthermore, a number of algorithms allow you to:

  • operate on members of types:

    This would be akin to passing in a predicate that extracts a member variable from a type to operate on instead of operating on the whole type. These algorithms usually have a By prefix:

    class C {

    int x;

    } auto arr1 = [new C(2), new C(3)]; auto arr2 = [new C(2), new C(3)]; assert(arr1.equalBy!"x"(arr2));

  • operate via unary or binary predicates:

    import std.math: ceil;
    assert([2.1, 2.4, 1.2, 2.9].difference!ceil([2.3, 0.1]).equal([1.2]));
    assert([2.1, 2.4, 1.2, 2.9].difference!((a, b) => ceil(a) < ceil(b))([2.3, 3.4]).equal([1.2]));
  • or both:

    struct A {
        int x;
    auto arr = [A(4), A(8), A(12)];
    assert(arr.pullBy!("x", a => a / 2)(5, 9).array == [A(12)]);


  • Algorithms that are possibly non-trivial to figure out from D's stadard library Phobos
  • Algorithms that are not in D's standard library
  • Ability to execute the algorithms on sequences other than ranges
  • Integration with Optional!T
  • Common utility functions
  • Functional programming utilities


  • algorithm: contains algorithms that operate mostly on sequences
  • ranges: contains navigational algorithms over ranges (moving/jumpting/iterating/etc)
  • functional: contains utilties for functional programming
  • lang: contains techniques that fill in required language bits (or just stuff I didn't know where to put)
  • utils: contains utility types and functions


There's a benchmark dub configuration that can be used to run algorithms and check their speeds. The idea behind this is supposed to be to help with regressions once I figure out how to generate reports.

  • Ali Akhtarzada
Sub packages:
ddash:algorithm, ddash:functional, ddash:utils, ddash:lang, ddash:range, ddash:common
ddash:range, ddash:utils, ddash:algorithm, ddash:functional, ddash:lang
0.26.0 2019-Oct-12
0.25.0 2019-Aug-01
0.24.0 2019-Jul-29
0.23.0 2019-Jul-29
0.22.0 2019-Jul-26
Show all 41 versions
Download Stats:
  • 0 downloads today

  • 0 downloads this week

  • 0 downloads this month

  • 331 downloads total

Short URL: