Clojure - ns-map



Returns a map of all the mappings for the namespace.

Syntax

Following is the syntax.

(ns-map namespace-name)

Parameters − ‘namespace-name’ is the namespace which needs to be found.

Return Value − Returns a map of all the mappings for the namespace.

Example

Following is an example of ns-map in Clojure.

(ns clojure.examples.example
   (:require [clojure.set :as set])
   (:gen-class))
(defn example []
   (println (count (ns-map 'clojure.core))))
(example)

Output

The above program produces the following output.

849

The count method is used to provide the total count of maps returned.

clojure_namespaces.htm
Advertisements