Lambda Tuple with Map Reduce

Salih Dincer salihdb at hotmail.com
Wed Apr 20 08:37:09 UTC 2022


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(" "); // Ok!
   }
   writeln; // "1115 188 102 86 47"
```



More information about the Digitalmars-d-learn mailing list