added step function to math utils

This commit is contained in:
Ryan Boldi 2022-03-12 13:55:47 -05:00
parent 72e31b5c4d
commit 83c7e440f6

View File

@ -6,6 +6,11 @@
(defonce E #?(:clj Math/E (defonce E #?(:clj Math/E
:cljs js/Math.PI)) :cljs js/Math.PI))
(defn step
"returns 1 if number is nonzero, 0 otherwise"
[x]
(if (zero? x) 0 1))
(defn abs (defn abs
"Returns the absolute value of a number." "Returns the absolute value of a number."
[x] [x]