MastodonC / kixi.stats

A library of statistical distribution sampling and transducing functions
https://cljdoc.xyz/d/kixi/stats
360 stars 18 forks source link

refer-clojure :exclude [abs] to silence 1.11.1 warnings #41

Closed dpsutton closed 2 years ago

dpsutton commented 2 years ago

Clojure 1.11.0+ now include a function abs in core

(defn abs
  {:doc "Returns the absolute value of a.
  If a is Long/MIN_VALUE => Long/MIN_VALUE
  If a is a double and zero => +0.0
  If a is a double and ##Inf or ##-Inf => ##Inf
  If a is a double and ##NaN => ##NaN"
   :inline-arities #{1}
   :inline (fn [a] `(clojure.lang.Numbers/abs ~a))
   :added "1.11"}
  [a]
  (clojure.lang.Numbers/abs a))

Three namespaces require a function named abs and generate warnings

WARNING: abs already refers to: #'clojure.core/abs in namespace: kixi.stats.math, being replaced by: #'kixi.stats.math/abs
WARNING: abs already refers to: #'clojure.core/abs in namespace: kixi.stats.test, being replaced by: #'kixi.stats.math/abs
WARNING: abs already refers to: #'clojure.core/abs in namespace: kixi.stats.distribution, being replaced by: #'kixi.stats.math/abs

It would be nice to add (:refer-clojure :exclude [abs]) in these namespaces. Note it is not an error to exclude a function that is not defined so using an older version of Clojure or ClojureScript will not have an error if you exclude a function that isn't defined in that version.