Skip to content

Instantly share code, notes, and snippets.

@michaelsbradleyjr
Created October 31, 2012 23:20
Show Gist options
  • Save michaelsbradleyjr/3990584 to your computer and use it in GitHub Desktop.
Save michaelsbradleyjr/3990584 to your computer and use it in GitHub Desktop.
plus-maybe
(defmacro plus-maybe [mvs]
`(let [mvs# (quote ~mvs)
mv# (eval (first mvs#))
mvs# (clojure.core/map (fn [mv#]
(if (= (class mv#) maybe-monad)
mv#
(eval mv#)))
(rest mvs#))]
(monads.core/plus-step mv# mvs#)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment