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
(require '[datomic.client.api :as d] | |
'[cognitect.transcriptor :as xr :refer (check!)]) | |
(def get-client | |
"This function will return a local implementation of the client | |
interface when run on a Datomic compute node. If you want to call | |
locally, fill in the correct values in the map." | |
(memoize #(d/client {:server-type :ion | |
:region "us-east-1" | |
:system "dynacode" |
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
(defn component [] | |
(js/Reflect.construct js/HTMLElement #js [] component)) | |
(set! (.-prototype component) | |
(js/Object.create (.-prototype js/HTMLElement) | |
#js {:connectedCallback | |
#js {:configurable true | |
:value | |
(fn [] | |
(this-as this |
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
{:deps | |
{org.clojure/clojure {:mvn/version "1.10.0-RC5"} | |
#_#_org.clojure/spec.alpha {:mvn/version "0.2.176"} | |
#_#_org.clojure/test.check {:mvn/version "0.10.0-alpha3"} | |
org.clojure/core.cache {:mvn/version "0.7.1"} | |
org.clojure/core.memoize {:mvn/version "0.7.1"} | |
}} |
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
(comment {:transcript "./extend.repl", :namespace cognitect.transcriptor.t_56}) | |
(require '[cognitect.transcriptor :refer (check!)]) | |
;;=> nil | |
(defprotocol | |
CustomerDatabase | |
:extend-via-metadata | |
true | |
(get-customer-by-id [db id]) | |
(update-customer-by-id [db id data]) |
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
(require | |
'[datomic.client.api :as d] | |
'[clojure.core.logic :refer :all] | |
'[clojure.core.logic.datomic :as ld]) | |
(defn entid [db k] | |
(-> db | |
(d/pull [:db/id] [:db/ident k]) | |
:db/id)) |
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
;; Let's start with a simple conditional interceptor that works with functions... | |
(defn conditional-context | |
"Given a keyword name and any variable predicate and terminator function pairs, | |
return an interceptor that will apply the terminator function paired to the first | |
truthy predicate. Predicates and terminators are both given the context as | |
the only argument. | |
If all predicates fail, the original context is returned." | |
[name-kw & pred-terms] |
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
(ns self-realizing.core | |
(:gen-class) | |
(:require [clojure.math.combinatorics :as combo])) | |
(defmacro ignore-errors | |
"Returns the result of evaluating e, or nil if it throws an exception." | |
[e] | |
`(try ~e (catch java.lang.Exception _# nil))) | |
(defn findr |