Fork me on GitHub
Endre Bakken Stovner05:06:24

@manutter51 @noisesmith Thanks! I will test out your suggestions later today. It should also be said that I run the code that calls tap> in a Thread. which might add another layer of weirdness. Here is the whole function:

(defn read-process [proc type jobid] ;; babashka/process
  (with-open [rdr (io/reader (type proc))]
    (binding [*in* rdr]
      (loop []
        (let [line (read-line)]
          (when (not (nil? line))
            (tap> [jobid type line])
Here is how it is called:
(.start (Thread. #(read-process bb-process :err jobid)))
(.start (Thread. #(read-process bb-process :out jobid)))


I am practising clojure program where I have 2 variable like below

(def  map1 [{:color "Orange" :size 8} {:color "blue" :size 9}] )
(def  map2 [{:size 8 :color "Orange" } {:color "yellow" :size 10} {:color "blue" :size 9}]) 
if any element of map 2 exist in map1 then store in some variable else store in other variable, I have checked with diff and compare did helped me, how can I write best program


(set/intersection (set map1) (set map2))


wow!!! how to get unmatched map ?


Also will this be a costly operation if we have n number of maps inside it?

Jacob Rosenzweig07:06:18

What does @conn in this context:

(def cfg ...)
(def conn (d/connect cfg))
(some-function @conn)


@ is a for deref, so it is just that. As a side note, database connections are usually put in a delay, which requires deref. To ensure the connection is only created when explicitly asked for.

Jacob Rosenzweig07:06:31

Does it reevaluate the var?

Jacob Rosenzweig07:06:09

Oh it's a deref?


quote is often helpful - it reveals what the reader expands without evaluating:

user=> '@foo
(clojure.core/deref foo)


it even reveals itself 😄

user=> ''foo
(quote foo)



user=> '#(+ % %)
(fn* [p1__159#] (+ p1__159# p1__159#))

Jacob Rosenzweig17:06:37

@noisesmith oh nice. I was doing (type foo) but this seems to tell me more.


it's not always useful, but it's easy to try and informative when it works


and learning why it works is a big step forward in deep understanding of clojure


Hi, I am trying to update a key in the map

(update {} :match (conj item)  )
returning (:match nil) how can I update key by adding new values, I am using this function in reduce


(update {} :match conj item)
No parens around (conj item)


this also worked for me `

(assoc acc :match (conj (get acc :match ) item))


but agree to update


I have a function, which is taking more than 3 minutes complete its operation due to huge data and it is expected, So I am planning to write it in multi threading application, any suggestion ?


• What does the data look like? • What does the function do?


I have 2 map which each has more than 100000 map again, I am comparing with another map


Don’t quite understand. You mean you have two vectors/lists/sets v1 and v2 which have 100000 hash-maps inside each? And you’re trying to compare v1[i] to v2[i]?


yes, checking element in one map is present in other or not


This can be parallelised, you can try pmap for a start. (pmap your-diff-fn v1 v2).


I think your v2 should be a btree so your O is logarithmic not n*n