RosettaCodeData/Task/Dot-product/Factor/dot-product.factor

6 lines
150 B
Factor
Raw Permalink Normal View History

2023-07-01 11:58:00 -04:00
USING: kernel math.vectors sequences ;
: dot-product ( u v -- w )
2dup [ length ] bi@ =
[ v. ] [ "Vector lengths must be equal" throw ] if ;