Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
3
Task/Dot-product/F-Sharp/dot-product.fs
Normal file
3
Task/Dot-product/F-Sharp/dot-product.fs
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
let dot_product (a:array<'a>) (b:array<'a>) =
|
||||
if Array.length a <> Array.length b then failwith "invalid argument: vectors must have the same lengths"
|
||||
Array.fold2 (fun acc i j -> acc + (i * j)) 0 a b
|
||||
Loading…
Add table
Add a link
Reference in a new issue