RosettaCodeData/Task/Dot-product/BCPL/dot-product.bcpl
2023-07-01 13:44:08 -04:00

14 lines
253 B
Text

get "libhdr"
let dotproduct(A, B, len) = valof
$( let acc = 0
for i=0 to len-1 do
acc := acc + A!i * B!i
resultis acc
$)
let start() be
$( let A = table 1, 3, -5
let B = table 4, -2, -1
writef("%N*N", dotproduct(A, B, 3))
$)