depth-first fold left
enum t = tuple(1, 2, tuple(3, tuple(tuple(4, 5), 6), 7)); import std.stdio; import std.conv : to; static assert(depthFirstFoldLeft!((a, b) => (a ~ b.to!string))("", t) == "1234567"); // TODO(karita) replace depthFirstFlatMap with depthFirstFoldLeft static assert(depthFirstFoldLeft!((a, b) => tuple(a.expand, b))(tuple(), t) == tuple(1, 2, 3, 4, 5, 6, 7));
higher order function for reduction from left via depth-fisrt search