Is there a way to pipeline program with random-access ranges in C#?

Kagamin spam at here.lot
Tue Mar 20 08:05:14 UTC 2018


On Monday, 19 March 2018 at 17:33:31 UTC, Dukc wrote:
> public static int Foo(int[] input)
> {   int result = 10;
>     for (int i = input.Length / 4; i >= 0; i -= 4)
>     {   int sum = 0;
>         for (int j = i; j < i +4 && j < input.Length; j++) sum 
> += input[j];
>         sum *= i;
>         result = (result + sum) / 2;
>     }
>     return result;
> }

Looks like you need to partition, select, aggregate and another 
aggregate.


More information about the Digitalmars-d-learn mailing list