Skip to content

Instantly share code, notes, and snippets.

@pnwamk
Last active August 29, 2015 14:16
Show Gist options
  • Save pnwamk/1ea1de2fb0673dc309a5 to your computer and use it in GitHub Desktop.
Save pnwamk/1ea1de2fb0673dc309a5 to your computer and use it in GitHub Desktop.
contradictory change
;; contradictory: Filter/c Filter/c -> boolean?
;; Returns true if the AND of the two filters is equivalent to Bot
;; OLD contradictory? definition
(define (contradictory? f1 f2)
(match* (f1 f2)
[((TypeFilter: t1 p) (NotTypeFilter: t2 p))
(subtype t1 t2)]
[((NotTypeFilter: t2 p) (TypeFilter: t1 p))
(subtype t1 t2)]
[((Bot:) _) #t]
[(_ (Bot:)) #t]
[(_ _) #f]))
;; New contradictory? definition
(define (contradictory? f1 f2)
(match* (f1 f2)
[((TypeFilter: t1 p) (NotTypeFilter: t2 p))
(subtype t1 t2)]
[((NotTypeFilter: t2 p) (TypeFilter: t1 p))
(subtype t1 t2)]
[((TypeFilter: t1 p) (TypeFilter: t2 p)) ;; NEW
(not (overlap t1 t2))] ;; NEW
[((Bot:) _) #t]
[(_ (Bot:)) #t]
[(_ _) #f]))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment