datalevin

yuhan 2025-09-09T17:18:09.972049Z

Is this a correctness bug or does Datalevin have different semantics from Datascript / Datomic re. unifying _ variables in queries?

(require '[datalevin.core :as d])

(d/q '[:find ?x ?y
       :where
       [_ :foo ?x]
       [_ :bar ?y]]
  (d/db-with (d/empty-db)
    [{:foo 1}
     {:bar 2}
     {:foo 3 :bar 4}]))
;; => #{[3 4]}

;; Datascript returns:
;; => #{[3 4] [1 4] [1 2] [3 2]}

Huahai 2025-09-09T17:22:08.364989Z

I would consider this a bug.

Huahai 2025-09-09T17:23:17.674839Z

As _ should not be treated as a variable

yuhan 2025-09-09T17:24:20.844949Z

ok good to know- will open a gh issue

yuhan 2025-09-09T17:30:47.100149Z

https://github.com/tonsky/datascript/issues/490 FYI there's this separate issue I found in datascript a couple of days ago, datalevin also behaves the same way

Huahai 2025-09-09T17:31:22.996559Z

Thanks