Unrepl / unrepl

A common ground for better Clojure REPLs
231 stars 17 forks source link

Problem with the printer #52

Open mauricioszabo opened 4 years ago

mauricioszabo commented 4 years ago

I found a strange behavior on the UNREPL printer while using datahike. Lauching a REPL with:

clj -Sdeps '{:deps {io.replikativ/datahike {:mvn/version "0.2.1"}}}'

and running the following code:

(ns dc.context
  (:require [datahike.api :as d]))

(def uri "datahike:mem://dc")
(def schema [{:db/ident :page/title
              :db/valueType :db.type/string
              :db/cardinality :db.cardinality/one
              :db/unique :db.unique/identity}])
(d/create-database uri :initial-tx schema)
(def conn (d/connect uri))
(:db-before
 (d/transact conn [{:page/title "Welcome"}
                   {:page/title "Hello World"}]))

It prints, for the last statement, the following:

[:eval #datahike.db.DB {1 :db/cardinality, 1 :db/ident, 1 :db/unique, 1 :db/valueType, 536870913 :db/txInstant} 13]

As you can see, there's multiple 1 keys. In a normal REPL, it prints:

#datahike/DB {:schema {:db/ident #:db{:unique :db.unique/identity}, :page/title #:db{:ident :page/title, :valueType :db.type/string, :cardinality :db.cardinality/one, :unique :db.unique/identity}, 1 :page/title}}