【问题标题】:Where did "-?>" go?“-?>”去哪儿了?
【发布时间】:2012-09-28 18:08:25
【问题描述】:

我正在寻找“-?>”,它与“->”的工作方式相同,除非其中一个线程函数返回 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。

什么/在哪里/如何访问此功能?谢谢。

【问题讨论】:

    标签: clojure macros


    【解决方案1】:

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

    【讨论】:

      猜你喜欢
      • 2011-03-03
      • 2014-03-15
      • 2015-07-17
      • 2012-10-30
      • 2013-05-23
      • 1970-01-01
      • 2012-03-13
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多