
In this guide, we will discuss Clojure disj. Disjoins an element from the set.
Syntax
Following is the syntax.
(disj setofelements x)
Parameters − ‘setofelements’ is the set of elements. ‘x’ is the element which needs to be removed from the set.
Return Value − Returns the new set with the removed element.
Example
Following is an example of disj in Clojure.
(ns clojure.examples.example (:gen-class)) (defn example [] (println (disj (set '(3 2 1)) 2))) (example)
Output
The above code produces the following output.
#{1 3}
Next Topic : Click Here
Pingback: Clojure - conj | Adglob Infosystem Pvt Ltd
Pingback: Clojure - Sets | Adglob Infosystem Pvt Ltd