How can I undefine a function in Clojure?

前端 未结 3 1072
你的背包
你的背包 2021-01-07 17:56

Often I need to undefine a function in clojure. If I define something with defn how can I undefine it?

3条回答
  •  不要未来只要你来
    2021-01-07 18:21

    There is no one-argument version, because the same Var can be mapped in more than one namespace. If you are working from the REPL, you often want to unbind from the user namespace, e.g.

    (ns-unmap 'user 'symbol-to-unbind)
    

    The first argument to ns-unmap can be a symbol or a namespace, and the second argument should be a symbol.

提交回复
热议问题