Accumulator factory: Difference between revisions

Content added Content deleted
(Replace existing solution by a more general one and add a solution using a customized number type.)
Line 2,128: Line 2,128:
We provide the code for the two last solutions.
We provide the code for the two last solutions.


==={{Fixed accumulator type}}===
=== Fixed accumulator type ===
<lang Nim>
<lang Nim>
proc accumulator[T: SomeNumber](x: T): auto =
proc accumulator[T: SomeNumber](x: T): auto =