November 01, 2013 Re: Using reduce() with tuples created by zip() | ||||
---|---|---|---|---|
| ||||
Posted in reply to Craig Dillabaugh Attachments:
| What I'm trying to explain is that reduce takes two arguments: the growing value and the current front. In your case, the current front is indeed a 2-tuple, but that's an unrelated issue. You're trying to get: reduce!( (firstElemOfPair, secondElemOfPair) => ...) (range) to work, whereas reduce signature is: reduce!( (onGoingValue, elem) => ...) (range) |
November 02, 2013 Re: Using reduce() with tuples created by zip() | ||||
---|---|---|---|---|
| ||||
Posted in reply to Philippe Sigaud | On Friday, 1 November 2013 at 20:08:15 UTC, Philippe Sigaud wrote:
> What I'm trying to explain is that reduce takes two arguments: the growing
> value and the current front. In your case, the current front is indeed a
> 2-tuple, but that's an unrelated issue.
>
> You're trying to get:
>
> reduce!( (firstElemOfPair, secondElemOfPair) => ...) (range)
>
> to work, whereas reduce signature is:
>
> reduce!( (onGoingValue, elem) => ...) (range)
OK, NOW I understand what you were trying to point out. The
function has to take the running sum (in my case) as one of the
arguments.
Thanks for your patience.
|
Copyright © 1999-2021 by the D Language Foundation