(map - ;; указываем функцию
[1 2 3] ;; список один
[3 2 1] ;; список два
)
;; => (-2 0 2)\
;; или
(map (fn [x y] (- x y))
[1 2 3]
[3 2 1])
(defn subtract-lists [lst1 lst2] (map - lst1 lst2)) (subtract-lists '(1 2 3) '(4 5 6)) ; => (-3 -3 -3)
(defn subtract-lists [lst1 lst2] (list (map - lst1 lst2))) (subtract-lists '(1 2 3) '(4 5 6)) ; => ((-3 -3 -3))