7 lines
187 B
Text
7 lines
187 B
Text
import lists.zipWith
|
|
|
|
def dot( a, b )
|
|
| a.length() == b.length() = sum( zipWith((*), a, b) )
|
|
| otherwise = error( "Vector sizes must match" )
|
|
|
|
println( dot([1, 3, -5], [4, -2, -1]) )
|