Clojure - Maps 的值



返回 Map 中值的列表。

语法

以下是语法。

(vals hmap)

参数 − ‘hmap’ 是哈希键和值的 Map。

返回值 − 返回 Map 中值的列表。

示例

以下是 Clojure 中 vals 的示例。

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

输出

上面的代码生成以下输出。

(1 3 2)
clojure_maps.htm
广告
© . All rights reserved.