parent
13df807576
commit
d5c9255cab
2 changed files with 19 additions and 2 deletions
11
tests/generics/t8403.nim
Normal file
11
tests/generics/t8403.nim
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
discard """
|
||||
output: "6.0"
|
||||
"""
|
||||
|
||||
proc sum*[T](s: seq[T], R: typedesc): R =
|
||||
var sum: R = 0
|
||||
for x in s:
|
||||
sum += R(x)
|
||||
return sum
|
||||
|
||||
echo @[1, 2, 3].sum(float)
|
||||
Loading…
Add table
Add a link
Reference in a new issue