cannot access frame of function
user1234
user1234 at 12.hu
Mon Sep 18 19:11:47 UTC 2017
On Monday, 18 September 2017 at 18:49:54 UTC, ag0aep6g wrote:
> 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);
> }
> ----
Aw right, i had put 1.23 directly in the lambda. So, OP, you can
dismiss my comment.
More information about the Digitalmars-d-learn
mailing list