I hereby claim:
- I am mlb- on github.
- I am mlbatema (https://keybase.io/mlbatema) on keybase.
- I have a public key whose fingerprint is 1188 2C08 1CDC 5C33 8E51 9D3F 1A93 0524 7F3F 9AB3
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
(defn find-subcoll-of-equal-int-nonint [coll] | |
(let [candidates (->> (range 2 (count coll) 2) | |
reverse | |
(map #(-> (partition % 1 coll) | |
(doto println))) | |
(reduce concat) | |
(filter (fn [candidate] | |
(let [{ints true | |
non-ints false} (group-by integer? | |
candidate)] |
;; This buffer is for notes you don't want to save, and for Lisp evaluation. | |
;; If you want to create a file, visit that file with C-x C-f, | |
;; then enter the text in that file's own buffer. | |
(defn get-that-thing | |
"Bind the event handler for clicks and have it `put!` into a | |
channel." | |
[] | |
;; The implementation of this is left to the reader. Who will | |
;; probably skim swannodette's blog. |
(let [[[x1 y1] [x2 y2] :as [c1 c2 :as cs]] [[1 2] [3 4]]] | |
{:x1 x1 | |
:y1 y1 | |
:x2 x2 | |
:y2 y2 | |
:c1 c1 | |
:c2 c2 | |
:cs cs}) |
(def paper-feet | |
(comp #(apply + %) | |
(juxt (partial apply min) | |
(comp #(* 2 %) | |
(partial apply +))) | |
#(map (partial apply *) %) | |
#(partition 2 1 (take 1 %) %) | |
#(map (fn [x] | |
(Integer/parseInt x)) | |
%) |
(defn happy-numbers | |
[n] | |
(letfn [(next-happy [n] | |
(->> n | |
str | |
(map (comp int | |
#(Math/pow % 2) | |
read-string | |
str)) | |
(reduce +)))] |
(defn gol | |
"Returns the next generation for a given game of life board" | |
[b] | |
(let [cells (for [x (range (count (first b))) | |
y (range (count b))] | |
[x y]) | |
is-alive? (fn [[x y]] | |
(= \# (get-in b [x y]))) | |
find-surrounding-live (fn [[cellx celly]] | |
(for [x (range (dec cellx) (+ 2 cellx)) |
(defn win-tic-tac-toe | |
[side b] | |
(let [b (->> b | |
flatten | |
(map-indexed vector)) | |
check-win (fn | |
[[a b c d e f g h i]] | |
(->> [[a b c] [d e f] [g h i] | |
[a d g] [b e h] [c f i] | |
[a e i] [c e g]] |
(defn findSubstring | |
"Finds the longest substring" | |
[s] | |
(->> (range (dec (count s)) 0 -1) | |
(map (fn [i] | |
(->> s | |
(partition i 1) | |
(map clojure.string/join) | |
getSubstring))) | |
(drop-while nil?) |
(defn fizzbuzz | |
[n] | |
(map-indexed (fn [n out] | |
(or (and (zero? (count out)) | |
(inc n)) | |
out)) | |
(apply map (fn [& args] | |
(apply str args)) | |
((apply juxt (map (fn [[mult sig]] | |
(fn [coll] |