From 08566ef6a62b9fb84b09fa2b1a747b5295d947ff Mon Sep 17 00:00:00 2001 From: Tony Garnock-Jones Date: Fri, 3 May 2019 20:29:40 +0100 Subject: [PATCH] Remove unneeded #:capture-projection argument to term->skeleton-interest --- imperative/relay.rkt | 63 ++++++++++++++++++++++---------------------- imperative/term.rkt | 7 ++--- 2 files changed, 34 insertions(+), 36 deletions(-) diff --git a/imperative/relay.rkt b/imperative/relay.rkt index d5168c2..a07766f 100644 --- a/imperative/relay.rkt +++ b/imperative/relay.rkt @@ -74,38 +74,39 @@ ;; (log-info "~a (asserted (observe (inbound ~v)))" inner-actor x) (with-current-facet [outer-facet] (with-non-script-context - (define outer-capture-proj (term->capture-proj x)) - (define inner-capture-proj (map (lambda (p) (cons 0 p)) outer-capture-proj)) - ;; ^ inner-capture-proj accounts for the extra (inbound ...) layer around assertions (define i - (term->skeleton-interest - x - #:capture-projection outer-capture-proj - (lambda (op . captured-values) - (define assertion - (instantiate-term->value (inbound x) captured-values - #:visibility-restriction-proj inner-capture-proj)) - ;; (log-info "~a => ~a ~a ~v" - ;; outer-facet - ;; inner-facet - ;; op - ;; assertion) - (match op - ['+ (apply-patch! inner-ds inner-actor (bag assertion +1))] - ['- (apply-patch! inner-ds inner-actor (bag assertion -1))] - ['! (send-assertion! (dataspace-routing-table inner-ds) assertion)]) - (schedule-inner!)) - #:cleanup - (lambda (cache) - (apply-patch! - inner-ds - inner-actor - (for/bag/count [(captured-values (in-bag cache))] - ;; (log-info "~a (cleanup) ~v" inner-actor term) - (values (instantiate-term->value (inbound x) captured-values - #:visibility-restriction-proj inner-capture-proj) - -1))) - (schedule-inner!)))) + (let ((inner-capture-proj + ;; inner-capture-proj accounts for the extra (inbound ...) layer around + ;; assertions + (let ((outer-capture-proj (term->capture-proj x))) + (map (lambda (p) (cons 0 p)) outer-capture-proj)))) + (term->skeleton-interest + x + (lambda (op . captured-values) + (define assertion + (instantiate-term->value (inbound x) captured-values + #:visibility-restriction-proj inner-capture-proj)) + ;; (log-info "~a => ~a ~a ~v" + ;; outer-facet + ;; inner-facet + ;; op + ;; assertion) + (match op + ['+ (apply-patch! inner-ds inner-actor (bag assertion +1))] + ['- (apply-patch! inner-ds inner-actor (bag assertion -1))] + ['! (send-assertion! (dataspace-routing-table inner-ds) assertion)]) + (schedule-inner!)) + #:cleanup + (lambda (cache) + (apply-patch! + inner-ds + inner-actor + (for/bag/count [(captured-values (in-bag cache))] + ;; (log-info "~a (cleanup) ~v" inner-actor term) + (values (instantiate-term->value (inbound x) captured-values + #:visibility-restriction-proj inner-capture-proj) + -1))) + (schedule-inner!))))) (add-endpoint-if-live! outer-facet inbound-endpoints x diff --git a/imperative/term.rkt b/imperative/term.rkt index 3117947..7ca0fd9 100644 --- a/imperative/term.rkt +++ b/imperative/term.rkt @@ -15,14 +15,11 @@ (require "pattern.rkt") (require "skeleton.rkt") -(define (term->skeleton-interest x - #:capture-projection [capture-proj (term->capture-proj x)] - handler - #:cleanup [cleanup #f]) +(define (term->skeleton-interest x handler #:cleanup [cleanup #f]) (skeleton-interest (term->skeleton x) (term->skeleton-proj x) (term->key x) - capture-proj + (term->capture-proj x) handler cleanup))