Clojure – *ns*

Clojure *ns*

In this guide, we will discuss Clojure *ns*. This is used to look at your current namespace.

Syntax

Following is the syntax.

(*ns*)

Parameters − None.

Return Value − Returns the namespace of the currently executing program.

Example

Following is an example of namespace in Clojure.

(ns clojure.examples.example
   (:require [clojure.set :as set])
   (:gen-class))
(defn example []
   (println *ns*))
(example)

Output

The above program produces the following output.

#object[clojure.lang.Namespace 0x50ad3bc1 clojure.examples.hello]

As you can see the output of the above program displays the namespace as clojure.examples.hello which is the name of the current namespace.

Next Topic : Click Here

This Post Has One Comment

Leave a Reply