Skip to content

Instantly share code, notes, and snippets.

@wfaler
Created June 11, 2012 11:27
Show Gist options
  • Save wfaler/2909653 to your computer and use it in GitHub Desktop.
Save wfaler/2909653 to your computer and use it in GitHub Desktop.
option in Clojure
(defn get-or-else [value default]
(if (nil? value)
(if (ifn? default)
(default)
default)
value))
(defn m-bind [value function]
(if (nil? value)
nil
(function value)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment