File tree Expand file tree Collapse file tree 2 files changed +13
-3
lines changed Expand file tree Collapse file tree 2 files changed +13
-3
lines changed Original file line number Diff line number Diff line change 25
25
-> ->>
26
26
partial comp complement constantly
27
27
vector str
28
+ hash-map map?
28
29
hash-set set?
29
30
map true false nil nth)
30
31
162
163
(datum->syntax
163
164
#'(kv ... )
164
165
(apply append (syntax->datum #'(kv.pair ... ))))
165
- #'(hash key-vals ... )]
166
+ #'(hash-map key-vals ... )]
166
167
[(_ proc:expr arg:expr ... )
167
168
#'(#%app proc arg ... )]))
168
169
221
222
[(char? v) (rkt:string v)]
222
223
[else (format "~s " v)])) ;; FIXME implement clojure printer and pr-str
223
224
225
+ (define (hash-map . args)
226
+ (apply hash args))
227
+
228
+ (define (map? v)
229
+ (and (hash? v) (immutable? v)))
230
+
224
231
(define (hash-set . args)
225
232
(apply rkt:set args))
226
233
Original file line number Diff line number Diff line change 8
8
(check-true (immutable? [1 2 3 ]))
9
9
(check-true (immutable? '[1 2 3 ]))
10
10
(check-true (immutable? (vector 1 2 3 )))
11
- (displayln {:a 5 :b 7 })
12
- (displayln {:a 5 , :b 7 })
13
11
(check-equal? [1 ,2 ,3 ] [1 2 3 ])
14
12
(check-equal? [1 2 (+ 1 2 )] [1 2 3 ])
15
13
(check-equal? '[1 2 (+ 1 2 )] [1 2 '(+ 1 2 )])
16
14
(check-equal? [1 2 [3 ]] (vector 1 2 (vector 3 )))
17
15
16
+ (displayln {:a 5 :b 7 })
17
+ (displayln {:a 5 , :b 7 })
18
+ (check-equal? {:a 5 :b 7 } (hash-map ':a 5 ':b 7 ))
19
+ (check-pred map? {:a 5 :b 7 })
20
+
18
21
(check-pred char? \a)
19
22
20
23
(check-pred set? #{1 2 3 })
You can’t perform that action at this time.
0 commit comments