Skip to content

Instantly share code, notes, and snippets.

View mlimotte's full-sized avatar

Marc Limotte mlimotte

View GitHub Profile
@jclaggett
jclaggett / deftype+.clj
Created March 10, 2014 13:32
:delegate option for deftype
(ns deftype+
"Augmented deftype sporting a new :delegate option.")
;; code to get the methods of interfaces and protocols
(defmulti get-methods
"Return a map of all method names to their arity."
class)
(defmethod get-methods clojure.lang.PersistentArrayMap
[protocol]
@mlimotte
mlimotte / merge-with-key.clj
Created April 24, 2012 15:10
Clojure merge-with-key
(ns mlimotte.util)
; A variation on clojure.core/merge-with
(defn merge-with-key
"Returns a map that consists of the rest of the maps conj-ed onto
the first. If a key occurs in more than one map, the mapping(s)
from the latter (left-to-right) will be combined with the mapping in
the result by calling (f key val-in-result val-in-latter)."
[f & maps]