This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; insert test case within project https://github.com/Datomic/day-of-datomic into 'lein repl' | |
(use '[datomic.api :only [q db] :as d]) | |
(use 'clojure.pprint) | |
(def uri "datomic:mem://seattle") | |
(d/create-database uri) | |
(def conn (d/connect uri)) | |
(def schema-tx (read-string (slurp "samples/seattle/seattle-schema.edn"))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defmacro bg | |
"Runs the body in a background thread. | |
Creates two vars, one named bg<N> and the other bg<N>'. | |
The first will eventually contain the result of the computation, | |
or any exception that is thrown. | |
The second is a map that prints with status & runtime information. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
lein test | |
lein test omlab.db.user-test | |
lein test :only omlab.db.user-test/user-changes | |
ERROR in (user-changes) (datalog.clj:1148) | |
Uncaught exception, not in assertion. | |
expected: nil | |
actual: java.lang.Exception: processing rule: (q__10347 ?op ?e ?a ?v), message: processing clause: (ref-keyword ?e ?a ?v), message: processing rule: [ref-keyword ?e ?a ?v], message: processing clause: [?en :db/ident ?v], message: Cannot resolve key: $2a$10$Hfb7nFYC8s7f7gX5wxsOZ.YvoFe7NVyc4jvOwITNR4ZDLNGOCO8Ci |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; | |
;; http://johnj.com/from-elegance-to-speed.html | |
;; | |
;; The Clojure version | |
;; ------------------- | |
(ns smt | |
(:require [net.cgrand.xforms :as x] | |
[criterium.core :as c :refer [quick-bench]])) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(def conforming? 'conforming?) | |
(defmethod clojure.test/assert-expr 'conforming? [msg form] | |
;; (is (conforming? schema structure)) | |
;; Asserts that evaluating structure conforms to the given malli schema | |
`(let [schema# ~(nth form 1) | |
structure# ~(nth form 2)] | |
(try (let [result# (m/validate schema# structure#)] | |
(if result# | |
(do-report {:type :pass, :message ~msg, |