Clojure – ns

Clojure ns

In this guide, we will discuss Clojure ns. This is used to create a new namespace and associate it with the running program.

Syntax

Following is the syntax.

(ns namespace-name)

Parameters − ‘namespace-name’ is the namespace which needs to be associated with the running program.

Return Value − None.

Example

Following is an example of ns in Clojure.

(ns clojure.myown
   (:require [clojure.set :as set])
   (:gen-class))
(defn hello-world []
   (println *ns*))
(hello-world)

Output

The above program produces the following output.

#object[clojure.lang.Namespace 0x50ad3bc1 clojure.myown]

Next Topic : Click Here

This Post Has 2 Comments

Leave a Reply