On Sun, Dec 30, 2012 at 4:32 AM, Meikel Brandmeyer <m...@kotka.de> wrote:

> (when-let [s (seq coll)]
>   (do-stuff-with s))
>

I would find when-let a lot more useful if it worked with multiple
bindings, e.g.,
(when-let [x blah1
               y blah2
               z blah3]
    (+ x y z))
should shortcut return nil if any of x, y, z evaluate to falsey.

Actually, I usually use Christophe Grand's version of when-let and if-let
which handle this.  I find it to be more useful that way.

Any idea why core's when-let/if-let don't behave this way?  I've been
looking through the monad material lately, and it seems like let is the
identity monad, for is the sequence monad, and when-let wants to be the
maybe monad, but isn't quite because it only handles one binding.  Doesn't
it seem most natural to let it handle multiple bindings?  What am I missing?

-- 
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

Reply via email to