Clojurcises: hash-map

Good practice. Use each of the following functions and macros to create or manipulate hash-maps in Clojure.

{}
hash-map

get
get-in (one keyword)
get-in (<map> [<key1> <key2>])

(<map> <key>)
(:<keyword> <map>)
(:<kw1> (:<kw2> <map>))

(-> <map> :<k1>)
(-> <map> :<k1> :<k2>)

assoc (change value)
assoc-in

assoc (add new key-value pair)
assoc-in

update (function only)
update (function with args)

update-in (function only)
update-in (function with args)

Leave a Reply

Your email address will not be published.