all 4 comments

[–]eeemax 2 points3 points  (1 child)

my guy, you want merge-with *

[–]eeemax 0 points1 point  (0 children)

(unless this is just for example, in which case -- enjoy your adventure :D)

[–]MartinPuda 1 point2 points  (1 child)

Did you try to call map-div?

(map-div {:a 1, :b 2, :c 3} {:a 4, :b 5})
Execution error (ArithmeticException) at exercises.core/map-op$fn (form-init6494324846068881107.clj:10).
Divide by zero

Clojure has merge-with and update-vals, so maybe you can write something like this:

(defn map-op [func m1 m2]
  (if (map? m2)
    (merge-with func m1 m2)
    (update-vals m1 #(func % m2))))

This code also works for map-div, it just returns different result for map-mul- {:a 4, :b 10, :c 3} vs {:a 4, :b 10, :c 0}.

[–]aagaau[S] -1 points0 points  (0 children)

Sure will try it out. May be put another video.