cannot access frame of function

ag0aep6g anonymous at example.com
Mon Sep 18 18:49:54 UTC 2017


On 09/18/2017 08:25 PM, user1234 wrote:
> On Monday, 18 September 2017 at 14:45:25 UTC, Alex wrote:
[...]
>> import std.algorithm.iteration : sum, cumulativeFold;
>>
>> void main()
>> {
>>     double[5] a;
[...]>>     auto asum = a[].sum;
[...]
> asum is a lazy range and the error comes from this.

asum is not a range. It's a double.

> Let's say that if you replace  asum by 1.23 then the code compiles.

Doesn't work for me. This still fails compilation with the same error:

----
import std.algorithm.iteration : sum, cumulativeFold;
void main()
{
     double[5] a;
     auto asum = 1.23;
     auto jProbs = a[].cumulativeFold!((a, b) => (a + b)/asum);
}
----


More information about the Digitalmars-d-learn mailing list