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

前端 未结 4 1676

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:14

    You need to exclude the functions that are imported by core:

     (ns your-ns
       (:refer-clojure :exclude [+ ...]))
    
     (defn + ...)
    

提交回复
热议问题