diff options
| author | 2021-10-16 11:27:30 +0300 | |
|---|---|---|
| committer | 2021-10-16 11:27:30 +0300 | |
| commit | 84463b24c49e8333b81567c5e0148b8f4bcd103f (patch) | |
| tree | 08dd6a3d5ac723e8f8fb8b11d6ee45fa575609b2 /srfi/srfi-69-impl.scm | |
| parent | merge (diff) | |
work
Diffstat (limited to 'srfi/srfi-69-impl.scm')
| -rw-r--r-- | srfi/srfi-69-impl.scm | 57 |
1 files changed, 20 insertions, 37 deletions
diff --git a/srfi/srfi-69-impl.scm b/srfi/srfi-69-impl.scm index 90c3b97..fe4edf3 100644 --- a/srfi/srfi-69-impl.scm +++ b/srfi/srfi-69-impl.scm @@ -4,17 +4,9 @@ (define (prep-dtd-arg proc) (lambda (dtd . args) (apply proc args))) - - (define (t69-make-hash-table* dtd comparator) - (define constructor-args - (if (not comparator) - '() - (let ((pred (comparator-equality-predicate comparator)) - (hash (comparator-hash-function comparator))) - (if hash - (list pred hash) - (list pred))))) - (apply t69-make-hash-table constructor-args)) + + (define (t69-hash-table-mutable?* dtd table) + #t) (define (t69-hash-table-ref* dtd table key fail success) (define default (cons #f #f)) @@ -57,29 +49,26 @@ (t69-hash-table-delete! table key)))) table) - (define (t69-hash-table-filter* dtd proc table) - (dict-filter! dtd proc (dict-copy dtd table))) - (define (t69-hash-table-fold* dtd proc knil table) (t69-hash-table-fold table proc knil)) - (define (t69-hash-table-search!* dtd table key fail success) + (define (t69-hash-table-alter!* dtd table key fail success) (define (handle-success value) - (define (update new-key new-value obj) + (define (update new-key new-value) (unless (eq? new-key key) (t69-hash-table-delete! table key)) (t69-hash-table-set! table new-key new-value) - (values table obj)) - (define (remove obj) + table) + (define (remove) (t69-hash-table-delete! table key) - (values table obj)) + table) (success key value update remove)) (define (handle-fail) - (define (ignore obj) - (values table obj)) - (define (insert value obj) + (define (ignore) + table) + (define (insert value) (t69-hash-table-set! table key value) - (values table obj)) + table) (fail insert ignore)) (define default (cons #f #f)) @@ -88,9 +77,6 @@ (handle-fail) (handle-success found))) - (define (t69-hash-table-search* dtd table key fail success) - (t69-hash-table-search!* dtd (dict-copy dtd table) key fail success)) - (define (t69-hash-table-comparator* dtd table) (make-comparator (lambda args #t) (or (t69-hash-table-equivalence-function table) @@ -99,24 +85,21 @@ (t69-hash-table-hash-function table))) (make-dtd - make-dictionary-id t69-make-hash-table* dictionary?-id (prep-dtd-arg t69-hash-table?) + dict-mutable?-id t69-hash-table-mutable?* dict-ref-id t69-hash-table-ref* dict-ref/default-id (prep-dtd-arg t69-hash-table-ref/default) - dict-set!-id t69-hash-table-set!* - dict-delete-all!-id t69-hash-table-delete-all!* + dict-set-id t69-hash-table-set!* + dict-delete-all-id t69-hash-table-delete-all!* dict-contains?-id (prep-dtd-arg t69-hash-table-exists?) - dict-update/default!-id t69-hash-table-update!/default* + dict-update/default-id t69-hash-table-update!/default* dict-size-id (prep-dtd-arg t69-hash-table-size) dict-keys-id (prep-dtd-arg t69-hash-table-keys) dict-values-id (prep-dtd-arg t69-hash-table-values) - dict-map!-id t69-hash-table-map!* - dict-filter!-id t69-hash-table-filter!* - dict-filter-id t69-hash-table-filter* + dict-map-id t69-hash-table-map!* + dict-filter-id t69-hash-table-filter!* dict-for-each-id t69-hash-table-foreach* dict-fold-id t69-hash-table-fold* dict->alist-id (prep-dtd-arg t69-hash-table->alist) - dict-search-id t69-hash-table-search* - dict-search!-id t69-hash-table-search!* - dict-comparator-id t69-hash-table-comparator* - dict-copy-id (prep-dtd-arg t69-hash-table-copy)))) + dict-alter-id t69-hash-table-alter!* + dict-comparator-id t69-hash-table-comparator*))) |
