Hello,
I am trying to figure out how to use clojure.core.reducers/reduce with core.matrix.operators/+.
Here is a little test example that I am thinking about:
(require '[clojure.core.reducers :as r])
(:refer-clojure :exclude [* - + == /])
(use 'clojure.core.matrix)
(use 'clojure.core.matrix.operators)
(def a [[1 2 3 4][1 -2 3 4][1 2 -3 4]])
core.matrix works here as this applies abs onto each element of each of the subvectors
(->> a
(r/map abs)
(into []))
This gives me the result that I want, but it creates a vector of vectors beforehand
(apply + (->> a
(r/map abs)
(into [])))
Something like this would be better; if it worked.
(->> a
(r/map abs)
(r/reduce +))
Is there away to do this?