Quantcast
Channel: clojure - refactor from atom into immutable - Stack Overflow
Browsing all 2 articles
Browse latest View live

Answer by noisesmith for clojure - refactor from atom into immutable

;; for starters, we can pass the counter through each reduce(defn build-tree [node xs] (let [[counter tree] (reduce (fn [[counter tree] x] (reduce (fn [[counter' t] l] (if-not (= (:val l) -1) (let...

View Article


clojure - refactor from atom into immutable

I have a nested reduce function and I amusing an atom named counter to increment a count every time a condition is met(defrecord TreeNode [val left right])(defn build-tree [node xs] (let [counter (atom...

View Article
Browsing all 2 articles
Browse latest View live




<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>