Clojure – Maps vals

Clojure maps vals

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

Syntax

Following is the syntax.

(vals hmap)

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

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

Example

Following is an example of vals in Clojure.

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

Output

The above code produces the following output.

(1 3 2)

Next Topic : Click Here

This Post Has 2 Comments

Leave a Reply