clojure — correct way to locally override operators such as “+”, “*”, etc

前端 未结 4 1680

What is the correct way to override a method like \"+\"? Right now I have

(defn- + [x y] (replacement x y))

but this results in warnings on the

4条回答
  •  庸人自扰
    2021-02-12 15:19

    You can also override built in arithmetic using generic interfaces from contrib, see the following for a simple example,

    http://nakkaya.com/2010/08/02/using-clojure-contrib-generic-interfaces/

提交回复
热议问题