Skip to content

Instantly share code, notes, and snippets.

@mefesto
Created May 25, 2011 04:06
Show Gist options
  • Select an option

  • Save mefesto/990307 to your computer and use it in GitHub Desktop.

Select an option

Save mefesto/990307 to your computer and use it in GitHub Desktop.
(defn call [f & args]
(when f (apply f args)))
(def callbacks
{:do-this #(println "this")
:do-that #(println "that")})
(call (:do-this callbacks)) ;; prints "this"
(call (:do-that callbacks)) ;; prints "that"
(call (:do-other callbacks)) ;; nil
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment