Clojure – Maps keys

Clojure maps keys

In this guide, we will discuss Clojure Maps Keys. Returns the list of keys in the map.

Syntax

Following is the syntax.

(keys hmap)

Parameters − ‘hmap’ is the map of hash keys and values.

Return Value − Returns the list of keys in the map.

Example

Following is an example of keys in Clojure.

(ns clojure.examples.example
   (:gen-class))
(defn example []
   (def demokeys (hash-map "z" "1" "b" "2" "a" "3"))
   (println (keys demokeys)))
(example)

Output

The above code produces the following output.

(z a b)

Next Topic : Click Here

This Post Has 2 Comments

Leave a Reply