On Thursday, 28 March 2024 at 23:08:54 UTC, rkompass wrote:
You can drop and take from the folded values range.
I got `[1, 0.67, 0.625, 0.619048, 0.618182, 0.618056,
0.618037, 0.618034, 0.618034, 0.618034]` from the above code.
Thank you so much...
I solved the problem: r.back doesn't wo
On Thursday, 28 March 2024 at 03:54:05 UTC, Salih Dincer wrote:
On Wednesday, 27 March 2024 at 20:50:05 UTC, rkompass wrote:
This works:
I decided to give the full code. Maybe then it will be better
understood what I mean. I actually pointed out the indirect
solution above but it's a bit ugl
On Wednesday, 27 March 2024 at 20:50:05 UTC, rkompass wrote:
This works:
I decided to give the full code. Maybe then it will be better
understood what I mean. I actually pointed out the indirect
solution above but it's a bit ugly and I'm sure there must be a
better way?
```d
import std.dat
On Wednesday, 27 March 2024 at 13:38:29 UTC, Salih Dincer wrote:
So, not works this:
```d
fib(1, 1).take(48)
//.array
.chunks(2)
.map!"a[1] / a[0]"
.back
.writeln; // 1.61803
```
Thanks...
SDB@79
This works:
```d
import std.stdio;
import std.ran
Is it possible to process both chunks without requiring memory
allocation (not using an array)?
For example:
```d
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).