Reputation: 14524
I am looking for "-?>", which works identically to "->" unless one of the threaded functions returns nil. If nil is ever encountered in the threading process, the return value of the threading expression is nil. Useful.
Here is where I am finding mention of this thing. http://clojuredocs.org/clojure_contrib/clojure.contrib.core/-_q%3E
from above site
Same as clojure.core/-> but returns nil as soon as the threaded value is nil itself (thus short-circuiting any pending computation).
Examples :
(-?> "foo" .toUpperCase (.substring 1)) returns "OO"
(-?> nil .toUpperCase (.substring 1)) returns nil
I am on clojure 1.4.
What/where/how do I get access to this functionality? Thank you.
Upvotes: 3
Views: 101
Reputation: 33019
Where did clojure.contrib
go? lists that clojure.contrib.core
was (partially) migrated to clojure.core.incubator
. This includes the old -?>
macro.
Upvotes: 4