datascript icon indicating copy to clipboard operation
datascript copied to clipboard

Datoms that differ only by :added key are considered equal

Open tomconnors opened this issue 8 years ago • 2 comments

(= (datascript.core/datom 1 :a "v" 500 true) (datascript.core/datom 1 :a "v" 500 false))
;; => true

Is this expected?

tomconnors avatar May 01 '17 00:05 tomconnors

I don’t remember at this point. What does Datomic do?

tonsky avatar May 01 '17 08:05 tonsky

Datomic doesn't make them equal unless the T is also equal:

(:import (datomic.db Datum))
(= 
  (Datum. 0 5 "f" 1)
  (Datum. 0 5 "f" 3))
;; => false

Notable: It uses the :db/id of the attribute in the Datom. And they use the lowest bit to encode assertion vs retraction.

rauhs avatar May 01 '17 08:05 rauhs