Clojure – ns-map

Clojure ns-map

In this guide, we will discuss 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.

Next Topic : Click Here

This Post Has 2 Comments

Leave a Reply