store/[org.clojure/clojure "1.8.0"] clj::clojure.core/ns-unmap

Community Documentation

Edit

Arities

[ns sym] -> nil

Usage

Removes a mapping for a symbol from the target namespace.

Namespace mappings represent top level bindings created by clj::clojure.core/def, and aliases for defs.

Note that mappings are distinct from aliases in that where mappings represent defs or renamings of defs (see clj::clojure.core/refer :rename) where aliases allow shorthand for other namespaces (see clj::clojure.core/require :as, clj::clojure.core/ns-unalias).

Source

(defn ns-unmap
  "Removes the mappings for the symbol from the namespace."
  {:added "1.0"
   :static true}
  [ns sym]
  (.unmap (the-ns ns) sym))

Example 1

Edit
(def foo 1)
;; => #'user/foo

foo
;; => 1

(ns-unmap 'user 'foo) ; explicit
;; => nil

(ns-unmap *ns* 'foo) ; convenient
;; => nil

foo
;; => "Unable to resolve symbol: foo in this context"

Uses on crossclj