26 lines
666 B
Plaintext
26 lines
666 B
Plaintext
|
|
(define hm1 (hash-map))
|
|
|
|
(hm/set! hm1 1 "a")
|
|
(hm/set! hm1 "a" (lambda (x) (+ x 1)))
|
|
|
|
(assert (= ((hm/get hm1 (hm/get hm1 1)) 2) 3))
|
|
|
|
(define hm2 (hash-map))
|
|
(hm/set! hm2 'yes :yes)
|
|
(hm/set! hm2 :yes 'yes)
|
|
|
|
(assert (= (hm/get hm2 'yes) :yes))
|
|
(assert (= (hm/get hm2 :yes) 'yes))
|
|
(assert (= (hm/get hm2 (hm/get hm2 'yes)) 'yes))
|
|
(assert (= (hm/get hm2 (hm/get hm2 :yes)) :yes))
|
|
(assert (= (hm/get hm2 (hm/get hm2 (hm/get hm2 'yes))) :yes))
|
|
(assert (= (hm/get hm2 (hm/get hm2 (hm/get hm2 :yes))) 'yes))
|
|
|
|
(define hm3 (hash-map))
|
|
(hm/set! hm3 + 'plus)
|
|
(hm/set! hm3 - 'minus)
|
|
|
|
(assert (= (hm/get hm3 +) 'plus))
|
|
(assert (= (hm/get hm3 -) 'minus))
|