flatten and filters before using them

This commit is contained in:
Sam Tobin-Hochstadt 2010-05-12 15:10:37 -04:00
parent e7c8ffb834
commit e0c82c8ac6

View File

@ -104,12 +104,19 @@
[else (loop (cdr ps) (cons p result))]))))]
[_ prop])))
(define (flatten-props ps)
(let loop ([ps ps])
(match ps
[(list) null]
[(cons (AndFilter: ps*) ps) (loop (append ps* ps))]
[(cons p ps) (cons p (loop ps))])))
(d/c (combine-props new-props old-props flag)
((listof Filter/c) (listof Filter/c) (box/c boolean?)
. -> .
(values (listof (or/c ImpFilter? OrFilter? AndFilter?)) (listof (or/c TypeFilter? NotTypeFilter?))))
(define (atomic-prop? p) (or (TypeFilter? p) (NotTypeFilter? p)))
(define-values (new-atoms new-formulas) (partition atomic-prop? new-props))
(define-values (new-atoms new-formulas) (partition atomic-prop? (flatten-props new-props)))
(let loop ([derived-props null]
[derived-atoms new-atoms]
[worklist (append old-props new-formulas)])