basilisp
basilisp copied to clipboard
`basilisp.math` namespace
We should add a basilisp.math
namespace which passes through the Python math
library functions in the same way as Clojure's 1.11 clojure.math
(code).
Split out from #672 and #662
Get the symbols in Clojure:
(require '[clojure.math :as math])
(sort (keys (ns-publics 'clojure.math)))
In Basilisp:
(import math)
(require '[basilisp.set :as set])
(def clj-math (set ...)) ;; copy the value from above
(def lpy-math (into #{} (comp (remove #(.startswith % "__")) (map #(.replace % "_" "-")) (map symbol)) (python/dir math)))
(def shared-math (set/intersection (set clj-math) (set lpy-math)))
(def clj-only (set/difference (set clj-math) (set lpy-math)))
(def lpy-only (set/difference (set lpy-math) (set clj-math)))
Note that several functions just have different names, but likely the same functionality.