- Clojure - Libraries
- Clojure - Automated Testing
- Clojure - Applications
- Clojure - Concurrent Programming
- Clojure - Java Interface
- Clojure - Databases
- Clojure - Reference Values
- Clojure - Macros
- Clojure - Watchers
- Clojure - Agents
- Clojure - StructMaps
- Clojure - Metadata
- Clojure - Atoms
- Clojure - Date & Time
- Clojure - Destructuring
- Clojure - Predicates
- Clojure - Regular Expressions
- Clojure - Sequences
- Clojure - Exception Handling
- Clojure - Namespaces
- Clojure - Maps
- Clojure - Vectors
- Clojure - Sets
- Clojure - Lists
- Clojure - Strings
- Clojure - File I/O
- Clojure - Recursion
- Clojure - Numbers
- Clojure - Functions
- Clojure - Decision Making
- Clojure - Loops
- Clojure - Operators
- Clojure - Variables
- Clojure - Data Types
- Clojure - REPL
- Clojure - Basic Syntax
- Clojure - Environment
- Clojure - Overview
- Clojure - Home
Clojure Useful Resources
Selected Reading
- Who is Who
- Computer Glossary
- HR Interview Questions
- Effective Resume Writing
- Questions and Answers
- UPSC IAS Exams Notes
Clojure - Namespaces
Namespaces in Clojure are used to differentiate classes into separate logical spaces just pke in Java. Consider the following statement.
(:require [clojure.set :as set])
In the above statement, ‘clojure.set’ is a namespace which contains various classes and methods to be used in the program. For example, the above namespace contains the function called map-invert, which is used to invert a map of key-values. We cannot use this function unless we exppcitly tell our program to include this namespace.
Let’s look at the different methods available for namespaces.
Sr.No. | Methods & Description |
---|---|
1 | This is used to look at your current namespace. |
2 | This is used to create a new namespace and associate it with the running program. |
3 | Add an apas in the current namespace to another namespace. Arguments are two symbols: the apas to be used and the symbopc name of the target namespace. |
4 | Returns a pst of all namespaces. |
5 | Finds and returns a particular namespace. |
6 | Returns the name of a particular namespace. |
7 | Returns the apases, which are associated with any namespaces. |
8 | Returns a map of all the mappings for the namespace. |
9 | Returns a map containing only those entries in map whose key is in keys. |