A map is a collection that assigns keys to values.
vals
map method in ClojureA vals
method is used to get all the values in a map.
(vals hmap)
The vals method receives one parameter:
hmap
: This is the map with hash key and value.
The vals
method returns a list of values in the map.
(ns clojure.examples.example(:gen-class))(defn valss [](def example (hash-map "z" "98" "x" "90" "u" "53"))(println (vals example)))(valss)
In the code above:
valss
.example
using the keyword def
and we assign our map to it.vals
method and we print them out using the println
method.valss
function.