diff options
| author | Rose Hogenson <rhogenson@posteo.net> | 2022-07-02 23:04:28 -0700 |
|---|---|---|
| committer | Rose Hogenson <rhogenson@posteo.net> | 2022-07-02 23:04:28 -0700 |
| commit | 37e086d27d478246e72b8f5c1b75ed5d092495fa (patch) | |
| tree | bae0ac5e3c7f0984ef259da6ad5d6f094b64e588 /csc/hash-map-test.csc | |
| parent | Add update conversion. (diff) | |
| download | chromatopelma-37e086d27d478246e72b8f5c1b75ed5d092495fa.tar.zst | |
Write closure conversion.
I desperately need a diffing library.
Diffstat (limited to 'csc/hash-map-test.csc')
| -rw-r--r-- | csc/hash-map-test.csc | 17 |
1 files changed, 5 insertions, 12 deletions
diff --git a/csc/hash-map-test.csc b/csc/hash-map-test.csc index f346e1e..677406e 100644 --- a/csc/hash-map-test.csc +++ b/csc/hash-map-test.csc @@ -15,15 +15,8 @@ (string<? (symbol->string s1) (symbol->string s2))) -(define (cmp-symbols s1 s2) - (cond - ((symbol<? s1 s2) -1) - ((symbol=? s1 s2) 0) - (else 1))) - - (define (alist->map->alist l) - (map->alist (alist->map hash-symbol cmp-symbols l))) + (map->alist (alist->map hash-symbol symbol<? l))) (define (sort-alist l) @@ -77,12 +70,12 @@ (test lookup (assert-equal 2 - (lookup (alist->map hash-symbol cmp-symbols '((a . 1) (b . 2) (c . 3))) 'b))) + (lookup (alist->map hash-symbol symbol<? '((a . 1) (b . 2) (c . 3))) 'b))) (test lookup-notfound (assert-raises key-not-found-error? - (lookup (alist->map hash-symbol cmp-symbols '((a . 1) (b . 2) (c . 3))) 'd))) + (lookup (alist->map hash-symbol symbol<? '((a . 1) (b . 2) (c . 3))) 'd))) (test merge @@ -91,5 +84,5 @@ (sort-alist (map->alist (merge - (alist->map hash-symbol cmp-symbols '((a . 1) (b . 2))) - (alist->map hash-symbol cmp-symbols '((c . 3) (d . 4)))))))) + (alist->map hash-symbol symbol<? '((a . 1) (b . 2))) + (alist->map hash-symbol symbol<? '((c . 3) (d . 4)))))))) |
