목차

map-invert

Inverts the maps so that the values become the keys and vice versa.

Syntax

(map-invert hmap)

Example

(ns clojure.examples.example
   (:require [clojure.set :as set])
   (:gen-class))
(defn example []
   (def demokeys (hash-map "z" 1 "b" 2 "a" 3))
   (def demonew (set/map-invert demokeys))
   (println demonew))
(example)

Output

{1 z, 3 a, 2 b}

Refs


관련 문서