I hereby claim:
- I am minimal on github.
- I am chrismcdevitt (https://keybase.io/chrismcdevitt) on keybase.
- I have a public key whose fingerprint is AD6C C227 E816 B829 5EE1 9083 AAA3 B78C 930D DCC6
To claim this, I am signing this object:
| module Data.PhoneBook where | |
| import Data.List | |
| import Data.Maybe | |
| import Control.Plus (empty) | |
| type Entry = { firstName :: String, lastName :: String, phone :: String } | |
| type PhoneBook = List Entry |
| (ns corematch-exp.core | |
| (:require [clojure.core.match :refer (match)])) | |
| (defn foo | |
| "I don't do a whole lot." | |
| [x] | |
| (println x "Hello, World!")) | |
| (let [x [1 2 3]] | |
| (match [x] |
I hereby claim:
To claim this, I am signing this object:
| (ann get-from-state | |
| (t/All [a b] | |
| [(t/Option (t/Map b a)) (t/Option (t/Coll b)) -> (t/Option a)])) | |
| (defn get-from-state [state keys] | |
| (t/loop [acc :- (t/Option a) nil | |
| keys :- (t/Option (t/Coll b)) keys] | |
| (if-not (and state (seq keys)) | |
| acc | |
| (recur (get state (first keys)) | |
| (rest keys))))) |
| (ns protobuf-exp.core | |
| (:require [flatland.protobuf.core :as pb]) | |
| (:import pi.Pages$Page)) | |
| (def Page (pb/protodef Pages$Page)) | |
| (def p (pb/protobuf Page :id 1 :url "http://blah.com" :description "I am a protobuf")) | |
| (defn write-to-file [proto path] | |
| (with-open [myout (clojure.java.io/output-stream path)] | |
| (.write myout (pb/protobuf-dump proto)))) |
| (defn flip-map | |
| "Map of vals to keys" | |
| [col] | |
| (persistent! (reduce-kv (fn [m k v] (assoc! m v k)) | |
| (transient {}) col))) |
| transducers-exp.core> (cr/bench (sequence xform data)) | |
| WARNING: Final GC required 3.920999473301486 % of runtime | |
| Evaluation count : 119337840 in 60 samples of 1988964 calls. | |
| Execution time mean : 548.637437 ns | |
| Execution time std-deviation : 85.741031 ns | |
| Execution time lower quantile : 474.085845 ns ( 2.5%) | |
| Execution time upper quantile : 732.818167 ns (97.5%) | |
| Overhead used : 2.067067 ns | |
| Found 5 outliers in 60 samples (8.3333 %) |
| transducers-exp.core> (cr/with-progress-reporting (cr/bench (sequence xform-small data))) | |
| Warming up for JIT optimisations 10000000000 ... | |
| compilation occured before 934629 iterations | |
| Estimating execution count ... | |
| Sampling ... | |
| Final GC... | |
| Checking GC... | |
| Finding outliers ... | |
| Bootstrapping ... | |
| Checking outlier significance |
| nfuncs | thread | transducers | |
|---|---|---|---|
| 17 | 28000 | 548 | |
| 6 | 3700 | 199 | |
| 2 | 21 | 50 |
| (ns transducers-exp.core | |
| (:require [criterium.core :as cr]) | |
| (:gen-class)) | |
| (def xform (comp (map inc) | |
| (filter even?) | |
| (dedupe) | |
| (mapcat range) | |
| (partition-all 3) | |
| (partition-by #(< (apply + %) 7)) |