 
 ;; Conn
 
-(defn conn? [conn]
+(defn conn?
+  "Returns true if this is a connection to a db, false otherwise."
+  [conn]
   (and #?(:clj  (instance? clojure.lang.IDeref conn)
           :cljs (satisfies? cljs.core/IDeref conn))
     (db/db? @conn)))
 
-(defn conn-from-db [db]
+(defn conn-from-db
+  "Given a database creates a connection to said database."
+  [db]
   (atom db :meta { :listeners (atom {}) }))
 
 (defn conn-from-datoms
+  "Creates a database for the given datoms and returns a connection
+  to said database. Takes an optional schema."
   ([datoms]        (conn-from-db (init-db datoms)))
   ([datoms schema] (conn-from-db (init-db datoms schema))))
 
 (defn create-conn
+  "Creates a connection to an empty database.
+  Takes an optional schema."
   ([]       (conn-from-db (empty-db)))
   ([schema] (conn-from-db (empty-db schema))))
 

;;  (clojure.edn/read-string {:readers datascript/data-readers} "...")
;;

(def data-readers {'datascript/Datom db/datom-from-reader
                   'datascript/DB    db/db-from-reader})

#?(:cljs
   (doseq [[tag cb] data-readers] (cljs.reader/register-tag-parser! tag cb)))

    (FilteredDB. db #(pred db %) (atom 0))))

(defn with
  "Apply the given transaction to the given database returning a
  transaction report map with :db-before, :db-after, :tx-data, :tempids
  and :tx-meta.
  Note that this function has no side-effects and the given database
  remains untouched."
  ([db tx-data] (with db tx-data nil))
  ([db tx-data tx-meta]
    {:pre [(db/db? db)]}
