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
mask =: _~:] | |
moves =: 1 :'(0 1, 0 _1, 1 0,: _1 0) |.!.m"1 2 ]' | |
step =: [:<./ ], (* +./@:(0 moves)@:mask) +"2 (_ moves)@:] | |
init =: * $ $!._ 1: | |
costs =: step^:_ init | |
M =: ([:".(;._1)',',])(;._1)_1|.(1!:1)<'p083_matrix.txt' | |
] p83 =: {:{: costs M |
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 [foo 1, foo 2] [foo foo]) | |
;; => [1 2] |
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 mapify | |
"Return a seq of maps like {:name \"Edward Cullen\" :glitter-index 10}" | |
[rows] | |
(let [headers (map (comp conversions headers->keywords) (first rows))] | |
(map (partial zipmap headers) (rest rows)))) |
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
∴ 0 seneca:~/ws/pedestal/samples/template-server git:master | |
$ git checkout -b aot-no-repro 2edb378 | |
Switched to a new branch 'aot-no-repro' | |
∴ 0 seneca:~/ws/pedestal/samples/template-server git:aot-no-repro | |
$ grep selmer project.clj | |
[selmer "0.7.6"] | |
∴ 0 seneca:~/ws/pedestal/samples/template-server git:aot-no-repro | |
$ find target/ -type f -name '*.class' |
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 repubsub.flat-json | |
(:require [clojure.core.protocols :as ccp] | |
[clojure.java.io :as io] | |
[cheshire (core :as json) (parse :as parse) (factory :as factory)]) | |
(:import [com.fasterxml.jackson.core | |
, JsonParser JsonFactory JsonFactory$Feature JsonGenerator$Feature | |
, JsonToken] | |
[java.io | |
, StringWriter StringReader BufferedReader BufferedWriter | |
, ByteArrayOutputStream PushbackReader])) |
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 permutron.core | |
(:require [clojure.core.protocols :as ccp] | |
[clojure.core.reducers :as r]) | |
(:import [clojure.lang Seqable Indexed Counted])) | |
;; Why are these private in clojure.core.reducers, but fjtask is public? | |
(def ^:private fjinvoke @#'r/fjinvoke) | |
(def ^:private fjfork @#'r/fjfork) | |
(def ^:private fjjoin @#'r/fjjoin) |
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 ffilter | |
"Returns the first item in `coll` for which `(pred item)` is true." | |
[pred coll] (reduce (fn [_ x] (if (pred x) (reduced x))) nil coll)) |
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
(defmacro assoc-keys | |
"The inverse of the {:keys [...]} binding form -- assoc the keyword form of | |
each symbol in syms with the bound value of that symbol." | |
[map & syms] `(assoc ~map ~@(mapcat (juxt keyword identity) syms))) |
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
(def ^:private type-max | |
{'byte Byte/MAX_VALUE, | |
'short Short/MAX_VALUE, | |
'int Integer/MAX_VALUE}) | |
(defn ^:private signed* | |
[type x] | |
(let [max (type-max type), roll (->> max long inc (* 2))] | |
`(~type (let [x# (long ~x)] (if (<= x# ~max) x# (- x# ~roll)))))) |
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 parse-nx | |
"Parse & filter raw NX records. Truncate QNAMEs to E2LDs." | |
[[sensor rest]] | |
(ignore-errors | |
(am/domonad am/maybe-m | |
[:when (not (v-sensor? sensor)) | |
[ts client domain :as fields] (str/split rest #"\t" 3) | |
:when (valid-fields? 3 fields) | |
ts (Long/parseLong ts 10) | |
domain (flat/domain-e2ld @etlds domain) |
NewerOlder