-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
Closed
Labels
bugIndicates an unexpected problem or unintended behaviorIndicates an unexpected problem or unintended behaviormathsMathematical functionsMathematical functionsstdlibJulia's standard libraryJulia's standard library
Description
sum for tuples uses +
which has the following two consequences:
- when a 1-element collection is passed
+
errors, while standardsum
silently accepts the value:
julia> sum(["a"])
"a"
julia> sum(("a",))
ERROR: MethodError: no method matching +(::String)
- no promotion happens (as standard
sum
usesadd_sum
):
julia> sum([0xe1, 0x1f])
0x0000000000000100
julia> sum((0xe1, 0x1f))
0x00
simeonschaub, AzamatB, ararslan, nalimilan and NHDaly
Metadata
Metadata
Assignees
Labels
bugIndicates an unexpected problem or unintended behaviorIndicates an unexpected problem or unintended behaviormathsMathematical functionsMathematical functionsstdlibJulia's standard libraryJulia's standard library