summaryrefslogtreecommitdiffstats
path: root/srfi/alist-impl.scm
diff options
context:
space:
mode:
authorGravatar John Cowan 2022-06-11 12:32:43 -0400
committerGravatar John Cowan 2022-06-11 12:32:43 -0400
commita40c97fc9a424a779e8d4a6e2899e61406f2e695 (patch)
tree50026a26bfca147bb17edf5667e6cbc730ffcf73 /srfi/alist-impl.scm
parentmerge with upstream (diff)
wip
Diffstat (limited to '')
-rw-r--r--srfi/alist-impl.scm82
1 files changed, 0 insertions, 82 deletions
diff --git a/srfi/alist-impl.scm b/srfi/alist-impl.scm
deleted file mode 100644
index 80b449d..0000000
--- a/srfi/alist-impl.scm
+++ /dev/null
@@ -1,82 +0,0 @@
-(define (make-alist-dto key=)
-
- (define (alist? dto l)
- (and (list? l)
- (or (null? l)
- (pair? (car l)))))
-
- (define (alist-pure? dto alist)
- #t)
-
- (define (alist-map dto proc alist)
- (map
- (lambda (e)
- (define key (car e))
- (define value (cdr e))
- (cons key (proc key value)))
- alist))
-
- (define (alist-filter dto pred alist)
- (filter
- (lambda (e)
- (pred (car e) (cdr e)))
- alist))
-
- (define (alist-delete dto key alist)
- (filter
- (lambda (entry)
- (not (key= (car entry) key)))
- alist))
-
- (define (alist-find-update dto alist key failure success)
- (define (handle-success pair)
- (define old-key (car pair))
- (define old-value (cdr pair))
- (define (update new-key new-value)
- (cond
- ((and (eq? old-key
- new-key)
- (eq? old-value
- new-value))
- alist)
- (else
- (let ((new-list
- (alist-cons
- new-key new-value
- (alist-delete dto old-key alist))))
- new-list))))
- (define (remove)
- (alist-delete dto old-key alist))
- (success old-key old-value update remove))
-
- (define (handle-failure)
- (define (insert value)
- (alist-cons key value alist))
- (define (ignore)
- alist)
- (failure insert ignore))
- (cond
- ((assoc key alist key=) => handle-success)
- (else (handle-failure))))
-
- (define (alist-size dto alist)
- (length alist))
-
- (define (alist->alist dto alist)
- alist)
-
- (define (alist-comparator dto dictionary)
- #f)
-
- (make-dto
- dictionary?-id alist?
- dict-pure?-id alist-pure?
- dict-map-id alist-map
- dict-filter-id alist-filter
- dict-find-update-id alist-find-update
- dict-size-id alist-size
- dict->alist-id alist->alist
- dict-comparator-id alist-comparator))
-
-(define alist-eqv-dto (make-alist-dto eqv?))
-(define alist-equal-dto (make-alist-dto equal?))