Steven Schveighoffer wrote:
One thing I was confused about, you are defining in the function how to
calculate a[n+1]? I find it more intuitive to define what a[n] is. For
example,
auto fib = series!("a[n - 2] + a[n - 1]")(1, 1); // reads a[n] = a[n-2] +
a[n-1]
It's even less confusing in the factorial example (IMO):
auto fact = series!("a[n - 1] * n")(1);
Of course, I don't know how the template-fu works, so I'm not sure if it's
possible ;)
It's entirely possible, and I think it's a good idea. I'll look into
changing the code. Thanks!
Andrei