On Friday, 22 April 2022 at 08:04:16 UTC, JG wrote:
On Thursday, 21 April 2022 at 21:02:47 UTC, JG wrote:
Hi,
Could someone possibly help me to understand why the commented
line doesn't compile?
Good job, works great! Potential is high:
```d
void main()
{
alias type = real;
auto range = iota!type(1, 4, .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 / 2;
alias func = type function(type a);
alias MR = MapResult!(typeof(range), func);
MR[] mr;
tuple(fun1, fun2, fun3, fun4, fun5)
.each!(f => mr ~= MR(range, f));
mr.writefln!"%-(%s\n%)";
} /* OUTPUT:
[1, 2.25, 4, 6.25, 9, 12.25]
[2, 3, 4, 5, 6, 7]
[2, 2.5, 3, 3.5, 4, 4.5]
[0, 0.5, 1, 1.5, 2, 2.5]
[0.5, 0.75, 1, 1.25, 1.5, 1.75]
*/
```