Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
16
Task/Dot-product/REBOL/dot-product.rebol
Normal file
16
Task/Dot-product/REBOL/dot-product.rebol
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
REBOL []
|
||||
|
||||
a: [1 3 -5]
|
||||
b: [4 -2 -1]
|
||||
|
||||
dot-product: function [v1 v2] [sum] [
|
||||
if (length? v1) != (length? v2) [
|
||||
make error! "error: vector sizes must match"
|
||||
]
|
||||
sum: 0
|
||||
repeat i length? v1 [
|
||||
sum: sum + ((pick v1 i) * (pick v2 i))
|
||||
]
|
||||
]
|
||||
|
||||
dot-product a b
|
||||
Loading…
Add table
Add a link
Reference in a new issue