<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
<channel>
<title>Clojure Q&amp;A - Recent questions tagged difference</title>
<link>https://ask.clojure.org/index.php/tag/difference</link>
<description></description>
<item>
<title>clojure.data/diff or clojure.set/difference return unexpected results</title>
<link>https://ask.clojure.org/index.php/11889/clojure-data-clojure-difference-return-unexpected-results</link>
<description>&lt;p&gt;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:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; first-sequence: #{{:id &quot;test&quot; :status :up} {:id &quot;other&quot; :status :up}}

second-sequence: #{{:id&quot;test&quot; :status :up} {:id &quot;other&quot; :status :up}}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;So with these two sets of data I execute the following sentence&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(seq (map #(produce!
            (adapt-schema %) producer)
          (first (clojure.data/diff first-sequence second-sequence))))
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;And I expect as result&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;[nil nil #{{:id &quot;test&quot; :status :up} {:id &quot;other&quot; :status :up}]
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;But I get in tests the following result from de diff and after I publish wrong number of messages&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;[#{{:id &quot;test&quot; :status :up} {:id &quot;other&quot; :status :up}#{{:id &quot;test&quot; :status :up} {:id &quot;other&quot; :status :up}nil]
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;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!&lt;/p&gt;
</description>
<category>Errors</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/11889/clojure-data-clojure-difference-return-unexpected-results</guid>
<pubDate>Thu, 12 May 2022 14:20:12 +0000</pubDate>
</item>
</channel>
</rss>