RosettaCodeData/Task/Dot-product/EchoLisp/dot-product.l
2023-07-01 13:44:08 -04:00

10 lines
182 B
Common Lisp

(define a #(1 3 -5))
(define b #(4 -2 -1))
;; function definition
(define ( a b) (for/sum ((x a)(y b)) (* x y)))
( a b) 3
;; library
(lib 'math)
(dot-product a b) 3