clojure - How do I multiply all elements in one collection with all the elements in another collection? -
say have:
(def s1 [1 2 3 4 5]) (def s2 [1 2 3 4 5])
for every x
in s1
, want multiply every y
in s2
.
to clarify, want cartesian product, don't think map
works here.
(for [x1 s1 x2 s2] (* x1 x2))
Comments
Post a Comment