If we worry about the string form and instead try:double reduce_string_loop() { return reduce!"1.0 / (a * a)"(iota(1, 100)); } double reduce_function_loop() { return reduce!((n) => 1.0 / (n * n))(iota(1, 100)); }
it should be write : double reduce_loop() { //return iota(1, 100).map!"1.0 / (a * a)".sum; return iota(1, 100).reduce!"a + 1.0 / (b * b)"; }