We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
init
sum
prod
1 parent 2122e0e commit 6918213Copy full SHA for 6918213
base/reduce.jl
@@ -520,6 +520,9 @@ for non-empty collections.
520
```jldoctest
521
julia> sum(1:20)
522
210
523
+
524
+julia> sum(1:20; init = 0.0)
525
+210.0
526
```
527
"""
528
sum(a; kw...) = sum(identity, a; kw...)
@@ -569,8 +572,11 @@ for non-empty collections.
569
572
570
573
# Examples
571
574
-julia> prod(1:20)
-2432902008176640000
575
+julia> prod(1:5)
576
+120
577
578
+julia> prod(1:5; init = 1.0)
579
+120.0
580
581
582
prod(a; kw...) = mapreduce(identity, mul_prod, a; kw...)
0 commit comments