From: Chris Hanson Date: Tue, 16 Jan 2018 04:24:48 +0000 (-0800) Subject: Move weak sets from predicate-metadata to boot. X-Git-Tag: mit-scheme-pucked-x11-0.3.1~7^2~358 X-Git-Url: https://birchwood-abbey.net/git?a=commitdiff_plain;h=515b9be6efa979285b11a948208fc46a5514bec4;p=mit-scheme.git Move weak sets from predicate-metadata to boot. Also flesh out slightly for future use. --- diff --git a/src/runtime/predicate-metadata.scm b/src/runtime/predicate-metadata.scm index 67cd2ebe9..346d93e3b 100644 --- a/src/runtime/predicate-metadata.scm +++ b/src/runtime/predicate-metadata.scm @@ -112,46 +112,6 @@ USA. (event-distributor/invoke! event:predicate-metadata 'set-tag<=! tag superset) (error "Tag already has this superset:" tag superset))) - -(define (%make-weak-set) - (%weak-cons 'weak-set '())) - -(define (%weak-set->list weak-set) - (weak-list->list (weak-cdr weak-set))) - -(define (%add-to-weak-set item weak-set) - (let loop - ((this (weak-cdr weak-set)) - (prev weak-set)) - (if (weak-pair? this) - (let ((item* (%weak-car this)) - (next (weak-cdr this))) - (cond ((not item*) - (weak-set-cdr! prev next) - (loop next prev)) - ((eq? item item*) - #f) - (else - (loop next this)))) - (begin - (weak-set-cdr! prev (%weak-cons item '())) - #t)))) - -(define (%weak-set-any predicate weak-set) - (let loop - ((this (weak-cdr weak-set)) - (prev weak-set)) - (if (weak-pair? this) - (let ((item (%weak-car this)) - (next (weak-cdr this))) - (cond ((not item) - (weak-set-cdr! prev next) - (loop next prev)) - ((predicate item) - #t) - (else - (loop next this)))) - #f))) (define event:predicate-metadata (make-event-distributor))