A structure which allows you to represent a computation as a sequence of steps. The monad allows you to decorate each step with additional processing rules.
- Logging
function! RunTests() | |
" reload the namespace | |
norm cpr | |
" setup | |
call clearmatches() | |
highlight Red ctermbg=darkred | |
redir => output | |
" use Clojure to do the real work, run tests, |
(ns test-app.foo | |
(:require [clojure.java.io :as io]) | |
(:import [java.util Properties])) | |
;;dotenv (w/ precedence per Colin -- shell > .env.foo > .env) | |
(defn f->p | |
[f] | |
(let [file (io/as-file f)] | |
(when (.exists file) (doto (Properties.) (.load (io/input-stream file)))))) |
(ns test-app.foo | |
(:require [taoensso.timbre.profiling :as p] | |
[datomic.api :as d])) | |
;; GOALS | |
;; * perf test both approaches | |
;; * compare size/complexity of code for boath approaches | |
;; Properties from input file. Only properties w/ even :id have been selected. | |
(def props-from-file |
(ns test-app.bar) | |
(defmulti do-it :foo) | |
(defmethod do-it "foo" | |
[m] | |
"foo'd it") | |
(defmethod do-it "bar" | |
[m] |
(ns testapp.core) | |
(def p (promise)) | |
(.start (java.lang.Thread. | |
(fn [] | |
(Thread/sleep 2000) | |
(deliver p "foozle") | |
(println "promise set")))) |
(ns test-app.core) | |
(def v1 [4 5 6]) | |
(def v2 [1 2 3]) | |
(def m {0 7 1 8}) | |
(def get* (fn [k a] (get a k))) | |
[(min-key first v1 v2) | |
(max-key (partial get* 0) v1 v2 m)] |
(ns test-app.core) | |
(def h (atom (make-hierarchy))) | |
(swap! h derive ::square ::shape) | |
(swap! h derive ::red-square ::square) | |
(def one (isa? @h ::red-square ::shape)) ;; => true |
(ns test-app.core) | |
(defprotocol Fooable | |
(foo [this f]) | |
(bar [this b])) | |
(deftype FooPrinter [] | |
Fooable | |
(foo [this f] (println "foo: " f)) | |
(bar [this b] (println "bar: " b))) |