Skip to content

Commit

Permalink
add 0-arity versons of '+' and '*'
Browse files Browse the repository at this point in the history
  • Loading branch information
2food committed Dec 14, 2023
1 parent 293a36c commit 7ae2493
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/broch/core.cljc
Original file line number Diff line number Diff line change
@@ -51,6 +51,7 @@
[f] (fn [x] (boxed f x)))

(defn +
([] 1)
([x] x)
([x y] (impl/boxed-arithmetic x y clojure.core/+))
([x y & more] (reduce + (+ x y) more)))
@@ -61,6 +62,7 @@
([x y & more] (reduce - (- x y) more)))

(defn *
([] 0)
([x] x)
([x y] (impl/boxed-arithmetic x y clojure.core/*))
([x y & more] (reduce * (* x y) more)))

0 comments on commit 7ae2493

Please sign in to comment.