diff options
| author | 2021-11-23 14:21:56 -0500 | |
|---|---|---|
| committer | 2021-11-23 14:21:56 -0500 | |
| commit | a6fbdb2cfe97b41c4479170d80934f218a1553a8 (patch) | |
| tree | b538484cf28d6b09b0cf021529302fc6b4273697 /srfi/srfi-126-impl.scm | |
| parent | improved rationale (diff) | |
dto and find-update
Diffstat (limited to 'srfi/srfi-126-impl.scm')
| -rw-r--r-- | srfi/srfi-126-impl.scm | 54 |
1 files changed, 27 insertions, 27 deletions
diff --git a/srfi/srfi-126-impl.scm b/srfi/srfi-126-impl.scm index bb55941..e1f62f1 100644 --- a/srfi/srfi-126-impl.scm +++ b/srfi/srfi-126-impl.scm @@ -1,4 +1,4 @@ -(define srfi-126-dtd +(define srfi-126-dto (let () (define-syntax guard-immutable @@ -13,20 +13,20 @@ (let ((table (t126-hashtable-copy table #f))) final-expr)))))) - (define (prep-dtd-arg proc) - (lambda (dtd . args) + (define (prep-dto-arg proc) + (lambda (dto . args) (apply proc args))) - (define (t126-hashtable-ref* dtd table key fail success) + (define (t126-hashtable-ref* dto table key fail success) (define-values (value found?) (t126-hashtable-lookup table key)) (if found? (success value) (fail))) - (define (t126-hashtable-ref/default* dtd table key default) + (define (t126-hashtable-ref/default* dto table key default) (t126-hashtable-ref table key default)) - (define (t126-hashtable-set* dtd table . obj) + (define (t126-hashtable-set* dto table . obj) (guard-immutable table (let loop ((obj obj)) (if (null? obj) @@ -36,7 +36,7 @@ (loop (cddr obj))))) table)) - (define (t126-hashtable-delete-all* dtd table keys) + (define (t126-hashtable-delete-all* dto table keys) (guard-immutable table (for-each (lambda (key) @@ -44,17 +44,17 @@ keys) table)) - (define (t126-hashtable-intern* dtd table key default) + (define (t126-hashtable-intern* dto table key default) (guard-immutable table (define val (t126-hashtable-intern! table key default)) (values table val))) - (define (t126-hashtable-update/default* dtd table key updater default) + (define (t126-hashtable-update/default* dto table key updater default) (guard-immutable table (t126-hashtable-update! table key updater default) table)) - (define (t126-hashtable-pop* dtd table) + (define (t126-hashtable-pop* dto table) (if (t126-hashtable-empty? table) (error "popped empty dictionary") (guard-immutable table @@ -63,24 +63,24 @@ (t126-hashtable-pop! table)) (values table key value)))) - (define (t126-hashtable-update-all* dtd proc table) + (define (t126-hashtable-update-all* dto proc table) (guard-immutable table (t126-hashtable-update-all! table proc) table)) - (define (t126-hashtable-filter* dtd proc table) + (define (t126-hashtable-filter* dto proc table) (guard-immutable table (t126-hashtable-prune! table (lambda (key value) (not (proc key value)))) table)) - (define (t126-hashtable-remove* dtd proc table) + (define (t126-hashtable-remove* dto proc table) (guard-immutable table (t126-hashtable-prune! table proc) table)) - (define (t126-hashtable-alter* dtd table key fail success) + (define (t126-hashtable-find-update* dto table key fail success) (define (handle-success value) (define (update new-key new-value) (guard-immutable table @@ -108,20 +108,20 @@ (handle-fail) (handle-success found))) - (define (t126-hashtable-for-each* dtd proc table) + (define (t126-hashtable-for-each* dto proc table) (t126-hashtable-walk table proc) table) - (define (t126-hashtable-map->lset* dtd proc table) + (define (t126-hashtable-map->lset* dto proc table) (t126-hashtable-map->lset table proc)) - (define (t126-hashtable-keys* dtd table) + (define (t126-hashtable-keys* dto table) (vector->list (t126-hashtable-keys table))) - (define (t126-hashtable-values* dtd table) + (define (t126-hashtable-values* dto table) (vector->list (t126-hashtable-values table))) - (define (t126-hashtable-entries* dtd table) + (define (t126-hashtable-entries* dto table) (call-with-values (lambda () (t126-hashtable-entries table)) (lambda (keys vals) @@ -129,14 +129,14 @@ (vector->list keys) (vector->list vals))))) - (define (t126-hashtable-comparator* dtd table) + (define (t126-hashtable-comparator* dto table) #f) - (make-dtd - dictionary?-id (prep-dtd-arg t126-hashtable?) - dict-mutable?-id (prep-dtd-arg t126-hashtable-mutable?) - dict-empty?-id (prep-dtd-arg t126-hashtable-empty?) - dict-contains?-id (prep-dtd-arg t126-hashtable-contains?) + (make-dto + dictionary?-id (prep-dto-arg t126-hashtable?) + dict-mutable?-id (prep-dto-arg t126-hashtable-mutable?) + dict-empty?-id (prep-dto-arg t126-hashtable-empty?) + dict-contains?-id (prep-dto-arg t126-hashtable-contains?) dict-ref-id t126-hashtable-ref* dict-ref/default-id t126-hashtable-ref/default* dict-set-id t126-hashtable-set* @@ -147,8 +147,8 @@ dict-map-id t126-hashtable-update-all* dict-filter-id t126-hashtable-filter* dict-remove-id t126-hashtable-remove* - dict-alter-id t126-hashtable-alter* - dict-size-id (prep-dtd-arg t126-hashtable-size) + dict-find-update-id t126-hashtable-find-update* + dict-size-id (prep-dto-arg t126-hashtable-size) dict-for-each-id t126-hashtable-for-each* dict-keys-id t126-hashtable-keys* dict-values-id t126-hashtable-values* |
