Clojure – all-ns

Clojure all-ns

In this guide, we will discuss Clojure all-ns. Returns a list of all namespaces.

Syntax

Following is the syntax.

(all-ns)

Parameters − None.

Return Value − The list of all namespaces.

Example

Following is an example of all-ns in Clojure.

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

Output

The above program produces the following output.

(#object[clojure.lang.Namespace 0x6bedbc4d clojure.core]
#object[clojure.lang.Namespace 0x932bc4a clojure.uuid]
#object[clojure.lang.Namespace 0xd29f28 clojure.set] #object[clo
jure.lang.Namespace 0x2fd1433e clojure.examples.hello]
#object[clojure.lang.Namespace 0x29d89d5d clojure.java.io]
#object[clojure.lang.Namespace 0x3514a4c0 clojure.main] #objec
t[clojure.lang.Namespace 0x212b5695 user] #object[clojure.lang.Namespace
0x446293d clojure.core.protocols] #object[clojure.lang.Namespace 0x69997e9d
clojure.instant] #object[cl
ojure.lang.Namespace 0x793be5ca clojure.string])

Basically, all of the namespaces available in Clojure will be returned.

Next Topic : Click Here

This Post Has 2 Comments

Leave a Reply