Dot product: Difference between revisions

Added Arturo implementation
(C++ alternative using std::inner_product)
(Added Arturo implementation)
Line 325:
{{Out}}
<lang AppleScript>3</lang>
 
=={{header|Arturo}}==
 
<lang rebol>dotProduct: function [a,b][
[ensure equal? size a size b]
 
result: 0
loop 0..(size a)-1 'i [
result: result + (a \ i) * (b \ i)
]
return result
]
 
print dotProduct @[1, 3, neg 5] @[4, neg 2, neg 1]
print dotProduct [1 2 3] [4 5 6]</lang>
 
{{out}}
 
<pre>3
32</pre>
 
=={{header|AutoHotkey}}==
1,532

edits