Add tasks for all the new languages
This commit is contained in:
parent
9dc3c2bb62
commit
bba7bfd280
13208 changed files with 134745 additions and 0 deletions
9
Task/Dot-product/Nim/dot-product.nim
Normal file
9
Task/Dot-product/Nim/dot-product.nim
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
# Compile time error when a and b are differently sized arrays
|
||||
# Runtime error when a and b are differently sized seqs
|
||||
proc dotp[T](a,b: T): int =
|
||||
assert a.len == b.len
|
||||
for i in a.low..a.high:
|
||||
result += a[i] * b[i]
|
||||
|
||||
echo dotp([1,3,-5], [4,-2,-1])
|
||||
echo dotp(@[1,2,3],@[4,5,6])
|
||||
Loading…
Add table
Add a link
Reference in a new issue