This file contains hidden or 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 user | |
(:require [clojure.tools.namespace.repl :refer [refresh]] | |
[com.stuartsierra.component :as component] | |
| |
[onyx api | |
[test-helper :refer [load-config validate-enough-peers!]]] | |
;; Implicit requires for env | |
[onyx.plugin.seq] | |
)) | |
|
This file contains hidden or 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
;; From https://github.com/ChrisBlom/dotfiles/blob/132db1a82d012dc495f762654b544b7c3a82d844/lein/tracetool.clj#L10 | |
(def pid | |
"Get current process PID" | |
(memoize | |
(fn [] | |
(-> (java.lang.management.ManagementFactory/getRuntimeMXBean) | |
(.getName) | |
(clojure.string/split #"@") | |
(first))))) |
This file contains hidden or 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 compile-get-in [path] | |
(let [f (reduce | |
(fn [acc k] | |
(fn [m] (get (acc m) k))) | |
identity path)] | |
(fn [m] | |
(f m)))) | |
(let [m {:a {:b 1}}] | |
(time (dotimes [i 100000] |
This file contains hidden or 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 | |
;; Deps | |
[cheshire "5.4.0"] | |
[manifold "0.1.1"] | |
[aleph "0.4.1-beta2"] | |
[org.clojure/clojure "1.7.0"] | |
[org.clojure/core.async "0.2.371"] | |
) | |
(require '[clojure.core.async :as a] |
This file contains hidden or 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 datomic.schema-dump | |
(:require | |
[datomic.api :as d] | |
[clojure.pprint])) | |
(defmethod clojure.pprint/simple-dispatch datomic.db.DbId [v] (pr v)) | |
(defmethod clojure.pprint/simple-dispatch datomic.function.Function [v] (pr v)) | |
(defn database-url [name] | |
(str "datomic:mem://" name)) |
This file contains hidden or 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 bs.utils.mock-connection | |
"Utilities for using Datomic" | |
(:require [datomic.api :as d]) | |
(:use clojure.repl clojure.pprint) | |
(:import (java.util.concurrent BlockingQueue LinkedBlockingDeque) | |
(datomic Connection))) | |
(defrecord MockConnection | |
[dbAtom, ^BlockingQueue txQueue] |
This file contains hidden or 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
;; Copyright (c) Alan Dipert. All rights reserved. | |
;; The use and distribution terms for this software are covered by the | |
;; Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php) | |
;; By using this software in any fashion, you are agreeing to be bound by | |
;; the terms of this license. | |
;; You must not remove this notice, or any other, from this software. | |
(ns alandipert.kahn | |
(:require [clojure.set :refer [difference union intersection]])) |
This file contains hidden or 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 alt-update [m k f] | |
;; Don't hold on to the old value of k by setting it to nil before the update | |
(assoc (assoc m k nil) | |
k (f (get m k)))) | |
(doseq [f [alt-update update] | |
n [10 | |
100 | |
1000 | |
10000 |
This file contains hidden or 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 adgoji.incanter.core | |
(:require [incanter.core :as incanter])) | |
(defn update-dataset [col-fn row-fn {:keys [column-names rows] :as dataset}] | |
(assoc (assoc dataset :rows nil) | |
:column-names (col-fn column-names) | |
:rows (row-fn rows))) | |
(defn wrap-with-transducer [xf] | |
(fn [coll] (sequence xf coll))) |
This file contains hidden or 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 group-by | |
([f] | |
(fn [rf] | |
(let [grouped-value (volatile! (transient {}))] | |
(fn | |
([] (rf)) | |
([result] | |
(rf result (persistent! @grouped-value))) | |
([result input] | |
(let [key (f input)] |