“ - ?>”在哪里走?

时间:2012-09-28 18:08:25

标签: clojure macros

我正在寻找“ - ?>”,其作用与“ - >”完全相同除非其中一个线程函数返回nil。如果在线程处理中遇到nil,则线程表达式的返回值为nil。是有用的。

这是我发现这件事的地方。 http://clojuredocs.org/clojure_contrib/clojure.contrib.core/-_q%3E

来自网站

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

我正在使用clojure 1.4。

我/在哪里/如何/如何获得此功能?谢谢。

1 个答案:

答案 0 :(得分:4)

Where did clojure.contrib go?列出了clojure.contrib.core已(部分)迁移到clojure.core.incubator的情况。这包括旧的-?>宏。

相关问题