Evan Gamble writes: > (when-let [a foo] > (let [b bar] > (when (even? b) > (let [c baz] > (when (> b c) > (let [d qux] > (f a b c d))))))) > > becomes: > > (let? [a foo :else nil > b bar :is even? > c baz :when (> b c) > d qux] > (f a b c d))
For yet another take on this, consider using the maybe-m monad from clojure.algo.monads: (domonad maybe-m [a foo b bar :when (even? b) c baz :when (> b c) d qux] (f a b c d)) This is not 100% equivalent because any nil result in the binding list will terminate the whole expression and return nil. That's quite often the right thing to do. If not, there is a way to introduce bindings that are allowed to be nil: (domonad maybe-m [a foo b bar :when (even? b) c baz :when (> b c) :let [d qux]] (f a b c d)) Konrad. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en