diff options
| author | 2022-08-06 11:35:06 +0300 | |
|---|---|---|
| committer | 2022-08-06 11:35:06 +0300 | |
| commit | fd4585b6e0ac67ae9591a4183fb7c82ed3a30218 (patch) | |
| tree | 8da6ad7744c6b26cbcf3acdd7d08e83c33c5e014 /srfi/225/srfi-69-impl.sld | |
| parent | Merge branch 'master' of https://github.com/johnwcowan/srfi-225 (diff) | |
return alists; refactor structure
Diffstat (limited to '')
| -rw-r--r-- | srfi/225/srfi-69-impl.sld (renamed from srfi/srfi-69-impl.scm) | 79 |
1 files changed, 43 insertions, 36 deletions
diff --git a/srfi/srfi-69-impl.scm b/srfi/225/srfi-69-impl.sld index 02e3d4a..6d04e4e 100644 --- a/srfi/srfi-69-impl.scm +++ b/srfi/225/srfi-69-impl.sld @@ -1,6 +1,12 @@ -(define srfi-69-dto - (let () - +(define-library + (srfi 225 srfi-69-impl) + (import (scheme base) + (srfi 128) + (prefix (srfi 69) t69-) + (srfi 225 default-impl) + (srfi 225 indexes)) + (export srfi-69-dto) + (begin (define (prep-dto-arg proc) (lambda (dto . args) (apply proc args))) @@ -12,16 +18,16 @@ (define default (cons #f #f)) (define found (t69-hash-table-ref/default table key default)) (if (eq? found default) - (fail) - (success found))) + (fail) + (success found))) (define (t69-hash-table-set!* dto table . obj) (let loop ((obj obj)) (if (null? obj) - table - (begin - (t69-hash-table-set! table (car obj) (cadr obj)) - (loop (cddr obj))))) + table + (begin + (t69-hash-table-set! table (car obj) (cadr obj)) + (loop (cddr obj))))) table) (define (t69-hash-table-update!/default* dto table key proc default) @@ -30,21 +36,21 @@ (define (t69-hash-table-delete-all!* dto table keys) (for-each - (lambda (key) - (t69-hash-table-delete! table key)) - keys) + (lambda (key) + (t69-hash-table-delete! table key)) + keys) table) (define (t69-hash-table-map!* dto proc table) (t69-hash-table-walk table (lambda (key value) - (t69-hash-table-set! table key (proc key value)))) + (t69-hash-table-set! table key (proc key value)))) table) (define (t69-hash-table-filter!* dto proc table) (t69-hash-table-walk table - (lambda (key value) - (unless (proc key value) - (t69-hash-table-delete! table key)))) + (lambda (key value) + (unless (proc key value) + (t69-hash-table-delete! table key)))) table) (define (t69-hash-table-fold* dto proc knil table) @@ -72,8 +78,8 @@ (define default (cons #f #f)) (define found (t69-hash-table-ref/default table key default)) (if (eq? default found) - (handle-fail) - (handle-success found))) + (handle-fail) + (handle-success found))) (define (t69-hash-table-comparator* dto table) (make-comparator (lambda args #t) @@ -82,21 +88,22 @@ #f (t69-hash-table-hash-function table))) - (make-dto - dictionary?-id (prep-dto-arg t69-hash-table?) - dict-pure?-id t69-hash-table-pure?* - dict-ref-id t69-hash-table-ref* - dict-ref/default-id (prep-dto-arg t69-hash-table-ref/default) - dict-set-id t69-hash-table-set!* - dict-delete-all-id t69-hash-table-delete-all!* - dict-contains?-id (prep-dto-arg t69-hash-table-exists?) - dict-update/default-id t69-hash-table-update!/default* - dict-size-id (prep-dto-arg t69-hash-table-size) - dict-keys-id (prep-dto-arg t69-hash-table-keys) - dict-values-id (prep-dto-arg t69-hash-table-values) - dict-map-id t69-hash-table-map!* - dict-filter-id t69-hash-table-filter!* - dict-fold-id t69-hash-table-fold* - dict->alist-id (prep-dto-arg t69-hash-table->alist) - dict-find-update-id t69-hash-table-find-update!* - dict-comparator-id t69-hash-table-comparator*))) + (define srfi-69-dto + (make-dto + dictionary?-id (prep-dto-arg t69-hash-table?) + dict-pure?-id t69-hash-table-pure?* + dict-ref-id t69-hash-table-ref* + dict-ref/default-id (prep-dto-arg t69-hash-table-ref/default) + dict-set-id t69-hash-table-set!* + dict-delete-all-id t69-hash-table-delete-all!* + dict-contains?-id (prep-dto-arg t69-hash-table-exists?) + dict-update/default-id t69-hash-table-update!/default* + dict-size-id (prep-dto-arg t69-hash-table-size) + dict-keys-id (prep-dto-arg t69-hash-table-keys) + dict-values-id (prep-dto-arg t69-hash-table-values) + dict-map-id t69-hash-table-map!* + dict-filter-id t69-hash-table-filter!* + dict-fold-id t69-hash-table-fold* + dict->alist-id (prep-dto-arg t69-hash-table->alist) + dict-find-update-id t69-hash-table-find-update!* + dict-comparator-id t69-hash-table-comparator*)))) |
