ddash 0.15.1
Utility library for D
To use this package, put the following dependency into your project's dependencies section:
ddash
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)]);
Features:
 Algorithms that are possibly nontrivial 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
Subpackages:
 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
Benchmarks
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.
 Registered by ali akhtarzada
 0.15.1 released a day ago
 aliak00/ddash
 MIT
 Copyright © 2017, Ali Akhtarzada
 Authors:
 Sub packages:
 ddash:algorithm, ddash:functional, ddash:utils, ddash:lang, ddash:range, ddash:common
 Dependencies:
 ddash:range, ddash:utils, ddash:algorithm, ddash:functional, ddash:lang
 Versions:

0.15.1 2019Apr17 0.15.0 2019Mar12 0.14.0 2019Mar11 0.13.2 2019Mar10 0.13.1 2019Mar10  Download Stats:


1 downloads today

6 downloads this week

61 downloads this month

179 downloads total

 Score:
 0.5
 Short URL:
 ddash.dub.pm