diff options
| author | Rose Hogenson <rhogenson@posteo.net> | 2022-07-24 16:20:00 -0700 |
|---|---|---|
| committer | Rose Hogenson <rhogenson@posteo.net> | 2022-07-24 16:20:00 -0700 |
| commit | c04e3c7cd6726a95da3d58979f582afb7a5b722f (patch) | |
| tree | 524f25bb188f90d68626a1f402f8de54e00848d4 /csc/macros.csc | |
| parent | Improve the loop macro collect statement. (diff) | |
| download | chromatopelma-c04e3c7cd6726a95da3d58979f582afb7a5b722f.tar.zst | |
Export some common comparers from hash-map.
Diffstat (limited to 'csc/macros.csc')
| -rw-r--r-- | csc/macros.csc | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/csc/macros.csc b/csc/macros.csc index 1edecd2..9afeea9 100644 --- a/csc/macros.csc +++ b/csc/macros.csc @@ -17,6 +17,7 @@ insert key-not-found-error? lookup + make-comparer map-for-each merge) (only (csc ir1) @@ -383,17 +384,20 @@ finally (return (< (length m1) (length m2))))) - (define (cmp-identifiers i1 i2) - (cond - ((bound-identifier=? i1 i2) 0) - ((or (string<? (symbol->string (identifier-name i1)) (symbol->string (identifier-name i2))) - (marks<? (marks i1) (marks i2))) - -1) - (else 1))) + (define compare-identifiers + (make-comparer + hash-identifier + (lambda (i1 i2) + (cond + ((bound-identifier=? i1 i2) 0) + ((or (string<? (symbol->string (identifier-name i1)) (symbol->string (identifier-name i2))) + (marks<? (marks i1) (marks i2))) + -1) + (else 1))))) (define (alist->substitutions l) - (alist->map hash-identifier cmp-identifiers l)) + (alist->map compare-identifiers l)) (define (is-underscore expression) |
