Open Necronian opened 7 years ago
Instead of aliasing / + - * to the equivalent decimal functions can they instead be functions that operate in the same manner as clojure?
I wrote this after looking at clojure.core:
(defn + ([] (decimal 0)) ([x] (decimal x)) ([x y] (plus x y)) ([x y & more] (reduce + (+ x y) more)))
(defn - ([x] (neg x)) ([x y] (minus x y)) ([x y & more] (reduce - (- x y) more)))
(defn / ([x] (div 1 x)) ([x y] (div x y)) ([x y & more] (reduce / (/ x y) more)))
(defn ([] (decimal 1)) ([x] (decimal x)) ([x y] (mul x y)) ([x y & more] (reduce (* x y) more)))
PR welcome for that!
Instead of aliasing / + - * to the equivalent decimal functions can they instead be functions that operate in the same manner as clojure?
I wrote this after looking at clojure.core:
(defn + ([] (decimal 0)) ([x] (decimal x)) ([x y] (plus x y)) ([x y & more] (reduce + (+ x y) more)))
(defn - ([x] (neg x)) ([x y] (minus x y)) ([x y & more] (reduce - (- x y) more)))
(defn / ([x] (div 1 x)) ([x y] (div x y)) ([x y & more] (reduce / (/ x y) more)))
(defn ([] (decimal 1)) ([x] (decimal x)) ([x y] (mul x y)) ([x y & more] (reduce (* x y) more)))