Is it possible to process both chunks without requiring memory allocation (not using an array)?
For example:
import std;
void main()
{
auto fib = (real a, real b)
=> recurrence!"a[n-1] + a[n-2]"(a, b);
auto myFib = fib(1, 1).take(48).array;
auto goldenRadio = myFib.chunks(2).map!
//"a[1] / a[0]";/* line #9
((a) {
const m = a.front;
a.popFront();
const n = a.front;
return m/n; });//*/
goldenRadio.back.writefln!"%.21f";
writeln("0.61803398874989484820");
}
Of course, it also works if you remove the comment marks on line #9 but I'm still using .array because the .chunks error tells me that.
So, not works this:
fib(1, 1).take(48)
//.array
.chunks(2)
.map!"a[1] / a[0]"
.back
.writeln; // 1.61803
Thanks...
SDB@79