aboutsummaryrefslogtreecommitdiff
path: root/src/main/clojure
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/clojure')
-rw-r--r--src/main/clojure/clojure/contrib/core.clj8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/main/clojure/clojure/contrib/core.clj b/src/main/clojure/clojure/contrib/core.clj
index fe6f50e9..c696ed12 100644
--- a/src/main/clojure/clojure/contrib/core.clj
+++ b/src/main/clojure/clojure/contrib/core.clj
@@ -43,6 +43,14 @@
"
.. .?.)
+(defnilsafe
+ "Same as clojure.core/->> but returns nil as soon as the threaded value is nil itself (thus short-circuiting any pending computation).
+ Examples :
+ (-?>> (range 5) (map inc)) returns (1 2 3 4 5)
+ (-?>> [] seq (map inc)) returns nil
+ "
+ ->> -?>>)
+
;; ----------------------------------------------------------------------
;; scgilardi at gmail