-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmaps.clj
57 lines (46 loc) · 998 Bytes
/
maps.clj
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
(ns seven-days-of-clojure.maps)
{}
{:id "abcd-1234"
:title "My Map"
:color "aqua"
:author {:id "dcba-4321"
:name "@me"}}
{:language "Clojure"
:version "1.10.0"
:author "Rich Hickey"
:year 2007}
(get {:id "abcd-1234"
:title "My Map"
:color "aqua"
:author {:id "dcba-4321"
:name "@me"}} :color)
;; get
(get {:language "Clojure"
:version "1.10.0"
:author "Rich Hickey"
:year 2007} :language)
;; assoc
(assoc {:language "Clojure"
:version "1.10.0"
:author "Rich Hickey"
:year 2007} :dialect "Lisp")
(assoc {:id "abcd-1234"
:title "My Map"
:color "aqua"
:author {:id "dcba-4321"
:name "@me"}} :title "My new Map")
;; merge
(merge {:a "a"} {:b "b"})
(merge {:id "0123-defg"
:name "Map"} {:keys {:id :name}})
;; keys
(keys {:id "abcd-1234"
:title "My Map"
:color "aqua"
:author {:id "dcba-4321"
:name "@me"}})
;; vals
(vals {:language "Clojure"
:version "1.10.0"
:author "Rich Hickey"
:year 2007})