Dot product: Difference between revisions
m
→{{header|Picat}}: Added {{out}}
m (→{{header|Picat}}: Added {{out}}) |
|||
Line 2,265:
dot_product(L1,L2) = _, L1.length != L2.length =>
throw($dot_product_not_same_length(L1,L2)).
dot_product(L1,L2) = sum([L1[I]*L2[I] : I in 1..L1.length]). </lang>
{{out}}
<pre>dot_product = 3
dot_product_not_same_length([1,2,3,4],[1,2,3])</pre>
=={{header|PicoLisp}}==
|