Data update
This commit is contained in:
parent
4bb20c9b71
commit
cbaf4c4b64
12390 changed files with 318560 additions and 27248 deletions
12
Task/Dot-product/ArkScript/dot-product.ark
Normal file
12
Task/Dot-product/ArkScript/dot-product.ark
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
(let dotProduct (fun (v1 v2) {
|
||||
(assert (= (len v1) (len v2)) "vectors should have the same length")
|
||||
|
||||
(mut result 0)
|
||||
(mut i 0)
|
||||
(while (< i (len v1)) {
|
||||
(set result (+ result (* (@ v1 i) (@ v2 i))))
|
||||
(set i (+ 1 i)) })
|
||||
|
||||
result }))
|
||||
|
||||
(print (dotProduct [1 3 -5] [4 -2 -1]))
|
||||
Loading…
Add table
Add a link
Reference in a new issue