On Wednesday, 20 April 2022 at 08:04:42 UTC, Salih Dincer wrote:
```d
alias type = real;
alias func = type function(type a);
[...]
I think technically you should have save after range in that loop.
On Wednesday, 20 April 2022 at 08:37:09 UTC, Salih Dincer wrote:
On Wednesday, 20 April 2022 at 08:04:42 UTC, Salih Dincer wrote:
I get an unexpected result inside the second foreach() loop.
Anyone know your reason?
It's my fault, here is the solution:
```d
foreach(fun; funs)
{
ra
On Wednesday, 20 April 2022 at 08:04:42 UTC, Salih Dincer wrote:
I get an unexpected result inside the second foreach() loop.
Anyone know your reason?
It's my fault, here is the solution:
```d
foreach(fun; funs)
{
range.map!(a => fun(a))
.reduce!sum
.write
```d
alias type = real;
alias func = type function(type a);
void main()
{
import std.range;
auto range = 10.iota!type(14, .5);
alias fun1 = (type a) => a * a;
alias fun2 = (type a) => a * 2;
alias fun3 = (type a) => a + 1;
alias fun4 = (type a) => a - 1;
alias fun5 = (type a) => a