Skip to content

Instantly share code, notes, and snippets.

View hays-hutton's full-sized avatar

Hays Hutton hays-hutton

  • Palo Alto Networks
  • United States
View GitHub Profile
@stuarthalloway
stuarthalloway / Datomic News Updates
Created June 18, 2012 14:53
Datomic update examples against a social news database
;; 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))
@stuarthalloway
stuarthalloway / gist:2560986
Created April 30, 2012 18:42
Datomic rule to find schema attributes whose name matches a prefix
;; The Datomic schema is made up of Datomic data, so you manipulate it
;; with ordinary queries and transactions -- and with ordinary code
;; in Java or Clojure.
;; query rule that finds attributes in schema whose names start with ?prefix
;; note the Java interop call to .startsWith
;; you could create a similar rule for namespace prefixes
(def rules '[[[attr-starts-with ?prefix ?attr]
[?e :db/valueType]
[?e :db/ident ?attr]