diff options
author | David Barksdale <amatus.amongus@gmail.com> | 2011-02-02 16:23:32 -0800 |
---|---|---|
committer | David Barksdale <amatus.amongus@gmail.com> | 2011-02-02 16:23:32 -0800 |
commit | aa0232d7c85162589f27c2bac903b0e12d0ce43f (patch) | |
tree | 13c76f7feacbecff6c69e827774ce50a4cbbd781 | |
parent | e4ea06c9ff93df3b3f667ab5768618ece5a98b6e (diff) |
Added :when-not and :when-let to add-monad-step, they can now be
used in your domonad expressions.
-rw-r--r-- | src/main/clojure/clojure/contrib/monads.clj | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/main/clojure/clojure/contrib/monads.clj b/src/main/clojure/clojure/contrib/monads.clj index 3cb1bd16..d164f7eb 100644 --- a/src/main/clojure/clojure/contrib/monads.clj +++ b/src/main/clojure/clojure/contrib/monads.clj @@ -72,8 +72,10 @@ monad comprehension expression mexpr." [mexpr step] (let [[bform expr] step] - (cond (identical? bform :when) `(if ~expr ~mexpr ~'m-zero) - (identical? bform :let) `(let ~expr ~mexpr) + (cond (identical? bform :when) `(if ~expr ~mexpr ~'m-zero) + (identical? bform :when-not) `(if ~expr ~'m-zero ~mexpr) + (identical? bform :let) `(let ~expr ~mexpr) + (identical? bform :when-let) `(if-let ~expr ~mexpr ~'m-zero) :else (list 'm-bind expr (list 'fn [bform] mexpr))))) (defn- monad-expr |