Clojure-maps-dissoc

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

Clojure-マップdissoc

キー値エントリをマップから分離します。

構文

構文は次のとおりです。

(dissoc hmap key)

パラメータ-「hmap」はハッシュキーと値のマップです。 「キー」は、HashMapから分離する必要があるキーです。

戻り値-分離されたキーでマップを返します。

以下はClojureのdissocの例です。

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

出力

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

{z 1, a 3}