Skip to content

Instantly share code, notes, and snippets.

@admay
admay / polymorphism-notes.clj
Last active March 16, 2017 18:25
null created by admay - https://repl.it/GYwt/13
;; Abstractions with multimethods, protocols, records
;; multimethods
;; useful for overloading based on dispatching
;; vnice
(ns ware-creatures)
(defmulti full-moon-behavior (fn [were-creature] (:were-type were-creature)))
;; Typical multimethods look like so...
(defmethod full-moon-behavior :wolf ;; dispatching value is a keyword