1 import std.experimental.all; 2 3 int len; 4 const r = 6.iota 5 .filter!(a => a % 2) // 1 3 5 6 .map!(a => a * 2) // 2 6 10 7 .tee!(_ => len++) 8 .sum 9 .reverseArgs!format("Sum: %d"); 10 11 assert(len == 3); 12 assert(r == "Sum: 18");
import std.experimental.all; assert(10.iota.map!(partial!(pow, 2)).sum == 1023);
Convenience file that allows to import entire Phobos in one command.