Add update-interests (similar to apply-patch)
This commit is contained in:
parent
1972a98d8b
commit
fb5a39d3af
|
@ -16,6 +16,7 @@
|
||||||
limit-patch
|
limit-patch
|
||||||
compute-aggregate-patch
|
compute-aggregate-patch
|
||||||
apply-patch
|
apply-patch
|
||||||
|
update-interests
|
||||||
unapply-patch
|
unapply-patch
|
||||||
compose-patch
|
compose-patch
|
||||||
patch-seq
|
patch-seq
|
||||||
|
@ -92,10 +93,17 @@
|
||||||
(patch (matcher-subtract (patch-added p) base #:combiner combiner)
|
(patch (matcher-subtract (patch-added p) base #:combiner combiner)
|
||||||
(matcher-subtract (patch-removed p) base #:combiner combiner)))
|
(matcher-subtract (patch-removed p) base #:combiner combiner)))
|
||||||
|
|
||||||
|
;; For use by Matchers leading to (Setof Label).
|
||||||
(define (apply-patch base p)
|
(define (apply-patch base p)
|
||||||
(match-define (patch in out) p)
|
(match-define (patch in out) p)
|
||||||
(matcher-union (matcher-subtract base out) in))
|
(matcher-union (matcher-subtract base out) in))
|
||||||
|
|
||||||
|
;; Like apply-patch, but for use by Matchers leading to True.
|
||||||
|
(define (update-interests base p)
|
||||||
|
(match-define (patch in out) p)
|
||||||
|
(matcher-union (matcher-subtract base out #:combiner (lambda (v1 v2) #f)) in
|
||||||
|
#:combiner (lambda (v1 v2) #t)))
|
||||||
|
|
||||||
(define (unapply-patch base p)
|
(define (unapply-patch base p)
|
||||||
(match-define (patch in out) p)
|
(match-define (patch in out) p)
|
||||||
(matcher-union (matcher-subtract base in) out))
|
(matcher-union (matcher-subtract base in) out))
|
||||||
|
@ -105,8 +113,7 @@
|
||||||
;; except for problems arising from use of set-subtract by default in {un,}apply-patch
|
;; except for problems arising from use of set-subtract by default in {un,}apply-patch
|
||||||
(match-define (patch in1 out1) p1)
|
(match-define (patch in1 out1) p1)
|
||||||
(match-define (patch in2 out2) p2)
|
(match-define (patch in2 out2) p2)
|
||||||
(patch (matcher-union (matcher-subtract in1 out2 #:combiner (lambda (v1 v2) #f)) in2
|
(patch (update-interests in1 p2)
|
||||||
#:combiner (lambda (v1 v2) #t))
|
|
||||||
(matcher-union (matcher-subtract out1 in2 #:combiner (lambda (v1 v2) #f)) out2
|
(matcher-union (matcher-subtract out1 in2 #:combiner (lambda (v1 v2) #f)) out2
|
||||||
#:combiner (lambda (v1 v2) #t))))
|
#:combiner (lambda (v1 v2) #t))))
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue