Accumulator factory: Difference between revisions

Content added Content deleted
(Added comment.)
(Added comment.)
Line 2,154: Line 2,154:
=== Fixed accumulator type ===
=== Fixed accumulator type ===
Argument to the factory function nay be any signed integer, unsigned integer or float.
Argument to the factory function nay be any signed integer, unsigned integer or float.
Argument to accumulator function must be of the same type.
Argument to the accumulator function must be of the same type.
Result of the accumulator function is also of the same type.
Result of the accumulator function is also of the same type.
<lang Nim>
<lang Nim>
Line 2,179: Line 2,179:


=== Customized number type ===
=== Customized number type ===
Argument to the factory function must be "int" or "float" (extension to other types is possible).
Argument of the accumulator function is of the customized type "Number" but may be "int" or "float"
thanks to the converters.
Result of the accumulator function is of type "Number" but will be displayed either as "int" or "float"
according to the actual contents.
<lang Nim>
<lang Nim>
type
type