reduceEx

Phobosのstd.algorithm.reduceの拡張です。 つまり、r.reduceEx!f(init)という呼び出しが有効になります。

template reduceEx(f...)
ref
reduceEx
(
R
E
)
(
auto ref R r
,
auto ref E e
)
if (
is(typeof(std.algorithm.reduce!f(forward!e, forward!r)))
)
if (
f.length >= 1
)

Examples

1 debug scope(failure) writefln("Unittest Failure :%s(%s) ", __FILE__, __LINE__);
2 debug scope(success) {writefln("Unittest Success :%s(%s)", __FILE__, __LINE__); stdout.flush();}
3 
4 assert(reduceEx!"a+1"([1, 2, 3], 1) == reduce!"a+1"(1, [1, 2, 3]));
5 assert(reduceEx!"a+1"([1, 2, 3]) == reduce!"a+1"([1, 2, 3]));

Meta