;; @ignore
;; Matches a pattern on datum, and calls consequent-thunk with the match result
;; if the pattern matches, or alternative-thunk with no arguments if it does not.
(define (p:if-matches pattern datum consequent-thunk alternative-thunk)
(let ((match-result (p:match pattern datum)))
(cond (match-result ; match succeeded!
(consequent-thunk match-result))
(else (alternative-thunk)))))