Implement pattern-matching, and-predicate, not-predicate, discard