为什么没有零?(Why there is no not-nil? in Clojure?)

在clojure中,我注意到具有逻辑对立的函数,如[[if x if-not] [every? x不是每个]]。 我想知道为什么[not-nil?]不包括在内,是故意还是因为它太琐碎。

对不起,我得问这个。

In clojure I noticed functions with logical opposites like [[if x if-not] [every? x not-every]]. I wonder why [not-nil?] is not included, is it on purpose or because it is too trivial.

Sorry, I gotta ask this.

最满意答案

有some? 自Clojure 1.6:

clojure.core/some? ([x]) Returns true if x is not nil, false otherwise.

https://clojuredocs.org/clojure.core/some_q

There is some? since Clojure 1.6:

clojure.core/some? ([x]) Returns true if x is not nil, false otherwise.

https://clojuredocs.org/clojure.core/some_q

更多推荐