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