Share your thoughts in the 2024 State of Clojure Survey!

Welcome! Please see the About page for a little more info on how this works.

0 votes
in Errors by
edited by

Hello folks!, I got a rare issue, where I have a 2 sets of maps and I need get the differences between both like the following example:

 first-sequence: #{{:id "test" :status :up} {:id "other" :status :up}}

second-sequence: #{{:id"test" :status :up} {:id "other" :status :up}}

So with these two sets of data I execute the following sentence

(seq (map #(produce!
            (adapt-schema %) producer)
          (first (clojure.data/diff first-sequence second-sequence))))

And I expect as result

[nil nil #{{:id "test" :status :up} {:id "other" :status :up}]

But I get in tests the following result from de diff and after I publish wrong number of messages

[#{{:id "test" :status :up} {:id "other" :status :up}#{{:id "test" :status :up} {:id "other" :status :up}nil]

But for example in the REPL I get the correct values so I'm lost with this behavior, any response will be very helpful for me. Thanks!

1 Answer

0 votes
by

Solved, my problem was that I get data from datomic so I need to coerce into schema and after do the diff with this resultant set

(->> all-results
         map #(schema/coerce! % models.schema/Result))
         set)
...