Skip to content

[NOTES] SUM function

Semseddin Moldibi edited this page Aug 20, 2018 · 1 revision

Design Notes On Sum and Average Functions

Simple sum (and average) function added to Red. See PR-3498

Currently sum doesn't coalesce return value as float! in case of integer overflow. This could be done by a safe refinement with a cost of performance.

Here you can see a comparison

But we generally do not use that kind of error handling, and add doesn't have safety too.

Also note that average always returns float! value.

It could also be done by a HOF accumulator/fold approach.

Also see @9214's comment

Clone this wiki locally