Clojure-maps-keys

提供:Dev Guides
移動先:案内検索

Clojure-マップキー

マップ内のキーのリストを返します。

構文

構文は次のとおりです。

(keys hmap)

パラメータ-「hmap」はハッシュキーと値のマップです。

戻り値-マップ内のキーのリストを返します。

Clojureのキーの例を次に示します。

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

出力

上記のコードは次の出力を生成します。

(z a b)