diff options
| author | 2021-08-19 01:22:35 +0300 | |
|---|---|---|
| committer | 2021-08-19 01:22:35 +0300 | |
| commit | 4c0820fa1b45ef4ea6976e950003fc48a70f4075 (patch) | |
| tree | bb744fd21eb5e7c135f1305075c1724ef82e9d38 /srfi | |
| parent | mapping implementation (diff) | |
update spec; fix default copy
Diffstat (limited to 'srfi')
| -rw-r--r-- | srfi/alist-impl.scm | 11 | ||||
| -rw-r--r-- | srfi/default-impl.scm | 9 | ||||
| -rw-r--r-- | srfi/plist-impl.scm | 3 |
3 files changed, 16 insertions, 7 deletions
diff --git a/srfi/alist-impl.scm b/srfi/alist-impl.scm index 4463d1c..e64dc97 100644 --- a/srfi/alist-impl.scm +++ b/srfi/alist-impl.scm @@ -96,8 +96,14 @@ (proc (car e) (cdr e))) (for-each proc* alist)) + (define (alist-copy dtd alist) + (map + (lambda (e) + (cons (car e) (cdr e))) + alist)) + (define (alist->alist dtd alist) - alist) + (alist-copy dtd alist)) (define (alist-comparator dtd dictionary) (make-comparator (lambda args #t) @@ -117,7 +123,8 @@ dict-size-index alist-size dict-for-each-index alist-foreach dict->alist-index alist->alist - dict-comparator-index alist-comparator)) + dict-comparator-index alist-comparator + dict-copy-index alist-copy)) (define alist-eqv-dtd (make-alist-dtd eqv?)) (define alist-equal-dtd (make-alist-dtd equal?)) diff --git a/srfi/default-impl.scm b/srfi/default-impl.scm index 649b6be..4253f6a 100644 --- a/srfi/default-impl.scm +++ b/srfi/default-impl.scm @@ -219,9 +219,12 @@ (default-dict-remove* dtd dict-filter! pred dictionary)) (define (default-dict-copy dtd dictionary) - (dict-map dtd - (lambda (key value) value) - dictionary)) + (define dict (make-dictionary (dict-comparator dtd dictionary))) + (dict-for-each dtd + (lambda (key value) + (set! dict (dict-set! dtd key value))) + dictionary) + dict) (define (default-dict-count dtd pred dictionary) (dict-fold dtd diff --git a/srfi/plist-impl.scm b/srfi/plist-impl.scm index e73bc94..dbec747 100644 --- a/srfi/plist-impl.scm +++ b/srfi/plist-impl.scm @@ -120,5 +120,4 @@ dict-copy-index plist-copy dict-size-index plist-size dict-for-each-index plist-foreach - dict-comparator-index plist-comparator) - )) + dict-comparator-index plist-comparator))) |
