Clojure-maps-keys

提供:Dev Guides
2020年6月22日 (月) 22:43時点におけるMaintenance script (トーク | 投稿記録)による版 (Imported from text file)
(差分) ← 古い版 | 最新版 (差分) | 新しい版 → (差分)
移動先:案内検索

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)