Can someone give me a very watered-down explanation of what std.range's recurrence! and sequence! do?

auto tri = sequence!((a,n) => n*(n+1)/2)();

/** okay, it's a triangular number array
* I understand n is the index number, the nth term
* However where does this 'a' go?
*/

auto odds = sequence!("a[0] + n * a[1]")(1, 2);

/** okay, this is a range of odd numbers
/ where and how do I plug (1, 2) into ""a[0] + n * a[1]"

sequence!("n+2")(1).take(10).writeln;
//[2, 3, 4, 5, 6, 7, 8, 9, 10, 11]
recurrence!("n+2")(1).take(10).writeln;
//[1, 3, 4, 5, 6, 7, 8, 9, 10, 11]

Reply via email to