|
8 | 8 | racket/unsafe/ops |
9 | 9 | racket/unsafe/undefined |
10 | 10 | racket/hash |
| 11 | + racket/treelist |
11 | 12 | (only-in racket/extflonum floating-point-bytes->extfl extfl->floating-point-bytes) |
12 | 13 | ;(only-in rnrs/lists-6 fold-left) |
13 | 14 | '#%paramz |
|
1294 | 1295 |
|
1295 | 1296 | [unsafe-undefined -Unsafe-Undefined] |
1296 | 1297 |
|
| 1298 | +;; Section 4.21 (TreeLists) |
| 1299 | + |
| 1300 | +[treelist (-poly (a) (->* (list) a (-treelist a)))] |
| 1301 | +[treelist-empty? (-> (-treelist Univ) B)] |
| 1302 | +[treelist-length (-> (-treelist Univ) -Index)] |
| 1303 | +[treelist-member? |
| 1304 | + (-poly (a) |
| 1305 | + (cl->* ((-treelist a) a . -> . Univ) |
| 1306 | + ((-treelist a) a (-> a a Univ) . -> . B)))] |
| 1307 | +[treelist-first (-poly (a) (-> (-treelist a) a :T+ #f))] |
| 1308 | +[treelist-last (-poly (a) (-> (-treelist a) a :T+ #f))] |
| 1309 | +[treelist-rest (-poly (a) (-> (-treelist a) (-treelist a)))] |
| 1310 | +[treelist-add (-poly (a) (-> (-treelist a) a (-treelist a)))] |
| 1311 | +[treelist-cons (-poly (a) (-> (-treelist a) a (-treelist a)))] |
| 1312 | +[treelist-delete (-poly (a) (-> (-treelist a) -Index (-treelist a)))] |
| 1313 | +[make-treelist (-poly (a) (-> -Nat a (-treelist a)))] |
| 1314 | +[treelist-ref (-poly (a) (-> (-treelist a) -Index a :T+ #f))] |
| 1315 | +[treelist-insert (-poly (a) (-> (-treelist a) -Index a (-treelist a)))] |
| 1316 | +[treelist-set (-poly (a) (-> (-treelist a) -Index a (-treelist a)))] |
| 1317 | +[treelist-take (-poly (a) (-> (-treelist a) -Index (-treelist a)))] |
| 1318 | +[treelist-drop (-poly (a) (-> (-treelist a) -Index (-treelist a)))] |
| 1319 | +[treelist-take-right (-poly (a) (-> (-treelist a) -Index (-treelist a)))] |
| 1320 | +[treelist-drop-right (-poly (a) (-> (-treelist a) -Index (-treelist a)))] |
| 1321 | +[treelist-sublist (-poly (a) (-> (-treelist a) -Index -Index (-treelist a)))] |
| 1322 | +[treelist-reverse (-poly (a) (-> (-treelist a) (-treelist a)))] |
| 1323 | +[treelist->list (-poly (a) (-> (-treelist a) (-lst a)))] |
| 1324 | +[list->treelist (-poly (a) (-> (-lst a) (-treelist a)))] |
| 1325 | +[treelist->vector (-poly (a) (-> (-treelist a) (-vec a)))] |
| 1326 | +[vector->treelist (-poly (a) (-> (-vec a) (-treelist a)))] |
| 1327 | +[in-treelist (-poly (a) (-> (-treelist a) (-seq a)))] |
| 1328 | +[treelist? (unsafe-shallow:make-pred-ty (-treelist Univ))] |
| 1329 | +[treelist-append (-poly (a) (->* (list) (-treelist a) (-treelist a)))] |
| 1330 | +[treelist-map (-poly (a b) (-> (-treelist a) (-> a b) (-treelist b)))] |
| 1331 | +[treelist-for-each (-poly (a b) (-> (-treelist a) (-> a b) -Void))] |
| 1332 | +[treelist-filter (-poly (a) (-> (-> a Univ) (-treelist a) (-treelist a)))] |
| 1333 | +[treelist-find (-poly (a) (-> (-treelist a) (-> a Univ) a :T+ #f))] |
| 1334 | +[treelist-index-of |
| 1335 | + (-poly (a) |
| 1336 | + (cl->* ((-treelist a) a . -> . -Index) |
| 1337 | + ((-treelist a) a (-> a a Univ) . -> . -Index)))] |
| 1338 | +[treelist-flatten (Univ . -> . (-treelist Univ))] |
| 1339 | +[treelist-append* (-poly (a) (-> (-treelist (-treelist a)) (-treelist a)))] |
| 1340 | +[treelist-sort |
| 1341 | +(-poly |
| 1342 | + (a b) |
| 1343 | + (cl->* |
| 1344 | + (->key (-treelist a) (-> a a -Boolean) #:key (-opt (-> a a :T+ #f)) #f #:cache-keys? -Boolean #f (-treelist a)) |
| 1345 | + (->key (-treelist a) (-> b b -Boolean) #:key (-> a b :T+ #f) #t #:cache-keys? -Boolean #f (-treelist a))))] |
| 1346 | + |
| 1347 | + |
1297 | 1348 | ;; Section 5.2 (Structure Types) |
1298 | 1349 | [make-struct-type |
1299 | 1350 | (->opt -Symbol |
|
0 commit comments