10 lines
201 B
Text
10 lines
201 B
Text
dotProduct[v1, v2] :=
|
|
{
|
|
if length[v1] != length[v2]
|
|
{
|
|
println["dotProduct: vectors are of different lengths."]
|
|
return undef
|
|
}
|
|
|
|
return sum[map[{|c1,c2| c1 * c2}, zip[v1, v2]]]
|
|
}
|