Skip to content

Instantly share code, notes, and snippets.

@MichaelDrogalis
Created December 19, 2014 03:52
Show Gist options
  • Save MichaelDrogalis/698c4468185798e76ee2 to your computer and use it in GitHub Desktop.
Save MichaelDrogalis/698c4468185798e76ee2 to your computer and use it in GitHub Desktop.
(ns dire-vec.core
(:require [dire.core :refer :all]))
(defn f-a [] (prn "Called A"))
(defn f-b [] (prn "Called B"))
(def fs [{:f #'f-a :m "In before A"} {:f #'f-b :m "In before B"}])
(doseq [f fs]
(with-pre-hook! (:f f)
(λ [& _]
(prn (:m f)))))
(f-a)
(f-b)
;;; Console:
"In before A"
"Called A"
"In before B"
"Called B"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment