I hereby claim:
- I am ztellman on github.
- I am ztellman (https://keybase.io/ztellman) on keybase.
- I have a public key whose fingerprint is 48C0 998F 1CA0 2F62 928D 6DC8 5E23 CF68 58E9 BE47
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
(ns advent17.core | |
(:require | |
[clojure.java.io :as io] | |
[clojure.string :as str])) | |
(defn neighbors [[x y z w]] | |
(-> | |
(for [x' (range (dec x) (+ 2 x)) | |
y' (range (dec y) (+ 2 y)) | |
z' (range (dec z) (+ 2 z)) |
(ns com.x.aleph-test | |
(require [aleph.http :as http] | |
[manifold.deferred :as d] | |
[manifold.stream :as s] | |
[compojure.core :only [routes ANY GET PUT POST] :as compojure] | |
[compojure.handler :as handler] | |
[clj-http.client :as http-client] | |
)) | |
(comment |
;; let's create a simple protocol that just returns a number | |
user> (defprotocol NumberP (number [_])) | |
NumberP | |
;; now we'll create an implementation that always returns '1' | |
user> (deftype One [] NumberP (number [_] 1)) | |
user.One | |
;; unsurprisingly, this type only has a single static value, which wraps the '1' | |
> (-> One .getDeclaredFields seq) |
var text = new PointText({ | |
position: view.center + [0, 200], | |
fillColor: 'black', | |
justification: 'center', | |
fontSize: 20 | |
}); | |
var originals = new Group({ insert: false }); // Don't insert in DOM. | |
var square = new Path.Circle({ |
(ns foami.core | |
"FOreign Asynchronous Mechanism Interop" | |
(:require [clojure.core.async :as async])) | |
(defn put! | |
"Takes a `ch`, a `msg`, a single arg function that when passed `true` enables backpressure | |
and when passed `false` disables it, and a no-arg function which, when invoked, closes the | |
upstream source." | |
[ch msg backpressure! close!] | |
(let [status (atom :sending] |
Fiction
More Technical
(use 'penumbra.opengl) | |
(require '(penumbra [app :as app])) | |
(def max-iterations 100) | |
(def num-paths 50) | |
(defn ikeda [x y u] | |
(iterate | |
(fn [[x_n y_n]] | |
(let [t_n (- 0.4 (/ 6 (+ 1 (* x_n x_n) (* y_n y_n))))] |
(defmacro if-in-str [haystack & clauses] | |
`(do | |
~@(map | |
(fn [clause] | |
(let [needle (first clause) | |
is-present-form (second clause) | |
is-not-present-form (nth clause 2 nil)] | |
`(if (> (.indexOf ~haystack ~needle) -1) | |
~is-present-form | |
~is-not-present-form))) |
(defn kafka-sink [] | |
(let [s (s/stream)] | |
(s/consume-async | |
(fn [msg] | |
(d/future (synchronous-put-to-kafka msg)))) | |
s)) |