aboutsummaryrefslogtreecommitdiff
path: root/src/main/clojure
diff options
context:
space:
mode:
authorStuart Halloway <stu@thinkrelevance.com>2010-04-12 22:01:58 -0400
committerStuart Halloway <stu@thinkrelevance.com>2010-04-12 22:01:58 -0400
commit9f448420b082ce8a6e577696df5203a405f4e8d4 (patch)
tree959fd9277daa1d73194bd905bf9949323e2eda21 /src/main/clojure
parent6dd033d9e12337f6630faa3d3f5c2e901a28c4f4 (diff)
-?>> per Chas Emerick
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