Skip to content

Instantly share code, notes, and snippets.


Keybase proof

I hereby claim:

  • I am loganmhb on github.
  • I am loganmhb ( on keybase.
  • I have a public key ASDyENxMBbdQ6JRJQzfhxRtuHxaXXi-37Ikljq7O5dCyQwo

To claim this, I am signing this object:

loganmhb / sset.lisp
Created October 2, 2019 13:49
Persistent sorted set implemented as a red-black tree in Common Lisp
View sset.lisp
;; todo: how do you actually manage dependencies?
(ql:quickload "generic-cl")
(ql:quickload "trivia")
;; Persistent red-black tree implemnetation per Okasaki's paper:
(defpackage sset
(:use generic-cl))
loganmhb / cas.clj
Created February 21, 2017 18:36
fun pathological atom situation
View cas.clj
(def a (atom 0))
(def f1 (future
(while (< @a 1000000000)
(swap! a inc))
(println "Done incrementing!")))
(def f2 (future
(swap! a (fn [current-val]
(println "Trying...`a' is" current-val)
loganmhb / for.clj
Last active August 25, 2016 19:12
spec-based for macro
View for.clj
(ns spec-test.core
(:require [clojure.spec :as s])
(:refer-clojure :exclude [for]))
(s/def ::for-bindings
(s/* (s/cat :lval any?
:rval any?
:modifiers (s/* (s/cat :type #{:when :let :while}
:modifier-body any?)))))
loganmhb / sentiment-scoring.clj
Last active August 29, 2015 14:17
Clojurepalooza homework - Sentiment scoring for words
View sentiment-scoring.clj
(def test-responses [{:r 5, :c "This is awesome!"}
{:r 1, :c "This sucks!"}
{:r 3, :c "This is all right."}])
(defn clean-contents
(update-in response
(comp (partial re-seq #"[a-z]+")