(when pred (foo) (bar)) just calls foo and then bar if pred evaluates to logical true, and falls through otherwise. There's no parentheses around the pred, so it just looks up pred without trying to call it as a function. So, it's not pred's return value it's conditioning on, but pred's own value.
So, pred is usually going to be a function, which isn't either false or nil, and then it's going to be treated as logical true, and foo and bar will be called. If some code is testing (when pred ...) then it is very likely, since pred would normally be a function but not a boolean, that the coder is allowing for pred to be nil. In the specific instance at issue, without the (when pred ...), (index-filter (something-that-evaluates-to-nil) (something-that-evaluates-to-a-nonempty-seq)) would blow up with a NullPointerException (on the (pred elt) call in the for loop). Instead, the whole thing short-circuits if pred is nil and returns nil, which is also often equivalent to an empty sequence, from this sequence-returning function. So, it's designed to treat a nil predicate as a predicate that categorically rejects everything. -- 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