为什么clojure允许使用lessthan(<)或大于(>)运算符/函数的单个参数

wil*_*nux 3 clojure

为什么clojure允许使用lessthan(<)或大于(>)运算符/函数的单个参数?我想知道为什么它只是返回'true'而不是强迫至少2个参数?

资源:

(defn >
  "Returns non-nil if nums are in monotonically decreasing order,
  otherwise false."
  {:inline (fn [x y] `(. clojure.lang.Numbers (gt ~x ~y)))
   :inline-arities #{2}
   :added "1.0"}
  ([x] true)
  ([x y] (. clojure.lang.Numbers (gt x y)))
  ([x y & more]
   (if (> x y)
     (if (next more)
       (recur y (first more) (next more))
       (> y (first more)))
     false)))
Run Code Online (Sandbox Code Playgroud)

Mar*_*her 7

如果你认为"单调递减"与"第一个之后的任何值大于前一个(我们将其拒绝为单调递减系列)"相同,那么两者的一个参数>(<如果你说增加/少于)履行这个定义.