diff options
author | David Barksdale <amatus.amongus@gmail.com> | 2011-02-02 16:23:32 -0800 |
---|---|---|
committer | David Barksdale <amatus.amongus@gmail.com> | 2011-05-23 23:10:54 -0500 |
commit | d4d53ecd0732d4808fe6cc604515f07aca551776 (patch) | |
tree | 462984fe90cb941e22d3083227a3779803e7b79d | |
parent | 4b562d9d110f169ea37c320edf96ad78c2fb2618 (diff) |
Added :when-not and :when-let to add-monad-step, they can now be
used in your domonad expressions.
-rw-r--r-- | modules/monads/src/main/clojure/clojure/contrib/monads.clj | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/modules/monads/src/main/clojure/clojure/contrib/monads.clj b/modules/monads/src/main/clojure/clojure/contrib/monads.clj index 3cb1bd16..d164f7eb 100644 --- a/modules/monads/src/main/clojure/clojure/contrib/monads.clj +++ b/modules/monads/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 |