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

0 votes
in Clojure by

PersistentQueue implements Sequential but doesn't implement java.util.List. Lists form an equality partition, as do Sequentials. This means that you can end up with nontransitive equality:

(def q (conj clojure.lang.PersistentQueue/EMPTY 1 2 3)) ;=> #user/q (def al (doto (java.util.ArrayList.) (.add 1) (.add 2) (.add 3))) ;=> #user/al (def v [1 2 3]) ;=> #user/v (= al v) ;=> true (= v q) ;=> true (not= al q) ;=> true

This happens because PersistentQueue is a Sequential but not a List, ArrayList is a List but not a Sequential, and PersistentVector is both.

19 Answers

0 votes
by

Comment made by: jafingerhut

This issue was run into again and a duplicate ticket CLJ-1374 created -- later closed as a duplicate of this one. Just wanted to record that this issue is being hit by others besides those originally reporting it.

0 votes
by

Comment made by: jafingerhut

One or more commits made to Clojure master between Aug 1 2014 and Aug 10 2014 conflict with the patch 001-clj-1059-make-persistentqueue-implement-list.diff, and it no longer applies cleanly.

0 votes
by

Comment made by: jafingerhut

Patch 002-clj-1059-asequential-rebased-to-cached-hasheq-v2.patch is identical to 002-clj-1059-asequential-rebased-to-cached-hasheq.diff, but applies cleanly to latest Clojure master as of 2018-May-23. Kept attribution of the original patch.

0 votes
by
Reference: https://clojure.atlassian.net/browse/CLJ-1059 (reported by ppotter)
...