Skip to content
View interactive-query-dev.clj
(def zap (partial + 1))
(d/q '[:find ?b
:in ?a
:where [(user/zap ?a) ?b]]
;; #{[2]}
(def zap (partial + 2))
(ns user)
(def app
"Intenal Helper"
(fnil conj []))
(defprotocol PathSeq
(path-seq* [form path] "Helper for path-seq"))
(extend-protocol PathSeq
View how-many-datoms.clj
'[datomic.api :as d])
(defn how-many-datoms-did-tx-make?
"Return the number of datoms created by transaction at
time t, defaulting t to the most recent transaction."
([conn] (how-many-datoms-did-tx-make? conn (-> conn d/db d/basis-t)))
([conn t]
(some-> (d/log conn) (d/tx-range t nil) first :data count)))
;; Complete schema history for a live Datomic database.
'[clojure.pprint :as pp]
'[clojure.set :as set]
'[datomic.api :as d])
;; fill this in with your own database connection
(def uri "datomic:dev://localhost:4334/my-db")
(def conn (d/connect uri))
(def db (d/db conn))
(require '[datomic.api :as d])
(def uri "datomic:mem://foo")
(d/create-database uri)
(def conn (d/connect uri))
@(d/transact conn [{:db/id (d/tempid :db.part/db)
:db/ident :card-1-reference
:db/valueType :db.type/ref
:db/isComponent true
View CSP cljs example tweaks
;; proposed change #1, objective: make update to q more evident
(defn peekn
"Returns vector of (up to) n items from the end of vector v"
[v n]
(if (> (count v) n)
(subvec v (- (count v) n))
(let [el (by-id "ex0")
out (by-id "ex0-out")]
;; from leiningen, use [dorothy/dorothy "0.0.3"]
(require '[dorothy.core :as dot])
;; dataflow copied from chat
(def dataflow '{:transform
{:outbound {:init {} :fn outbound-transform}
:inbound {:init {} :fn inbound-transform}
:nickname {:init nil :fn nickname-transform}}
:effect {:outbound send-message-to-server}
;; Datomic example code
;; Demonstrates using datalog with Clojure defrecords
(use '[datomic.api :only [q db] :as d])
(defrecord Supplier [number name status city])
(defrecord Part [number name colour weight city])
(defrecord Shipment [supplier part quantity])
;; sample data
;; groovy-datomic example ( in Clojure
(use '[datomic.api :only (q db) :as d])
(def uri "datomic:mem://comics")
(d/create-database uri)
(def conn (d/connect uri))
[{:db/id #db/id[:db.part/db]
:db/ident :issue/comic
;; Datomic example code
;; demonstrates various update scenarios, using a news database
;; that contains stories, users, and upvotes
;; grab an in memory database
(use '[datomic.api :only (q db) :as d])
(def uri "datomic:mem://foo")
(d/create-database uri)
(def conn (d/connect uri))
Something went wrong with that request. Please try again.