1 module nxt.projectEuler; 2 3 /** Solve Euler Problem 2. 4 See_Also: https://www.reddit.com/r/programming/comments/rif9x/uniform_function_call_syntax_for_the_d/ 5 */ 6 auto problem2() 7 { 8 import std.range : recurrence; 9 import std.algorithm.iteration : filter, reduce; 10 import std.algorithm.searching : until; 11 return recurrence!"a[n-1] + a[n-2]"(1, 1).until!"a > 4_000_000"() 12 .filter!"a % 2 == 0"() 13 .reduce!"a + b"(); 14 } 15 16 unittest 17 { 18 assert(problem2() == 4613732); 19 }