datascript

magra 2025-03-12T16:05:01.415639Z

I would like to use datom literals in testing. But the reader throws. Here what I experience at the repl:

(let [conn   (ds/create-conn {})
      result (ds/transact! conn [{:name "Maksim"}])]
  (:tx-data result))
=> [#datascript/Datom [1 :name "Maksim" 536870913 true]]
Eval this in repl or test right hand side.
=> Syntax error (IllegalArgumentException) compiling fn* at (src/core.clj:0:0).
   No matching field found: idx for class datascript.db.Datom
Funnily this works:
(read-string "[#datascript/Datom [1 :name \"Maksim\" 536870913 true]]")
=> [#datascript/Datom [1 :name "Maksim" 536870913 true]]
Why can I read it with read-string but not with the repl reader?
*data-readers*
=> {datascript/Datom #'datascript.db/datom-from-reader,
    datascript/DB #'datascript.db/db-from-reader
    ...}

Niki 2025-03-12T16:59:14.443199Z

Looks like you found a bug! https://clojure.atlassian.net/jira/software/c/projects/CLJ/issues/CLJ-2904

magra 2025-03-12T21:29:16.797249Z

Wow! I didn't see that one coming! Thanx!!!!

raspasov 2025-03-31T03:01:43.200989Z

I just ran into this as well