[racket-dev] check-match?

From: Joe Gibbs Politz (joe at cs.brown.edu)
Date: Mon Nov 19 20:56:05 EST 2012

>  (? P) => (lambda (x) (match x [P true] [_ false]))

I like this quite a bit.  It wouldn't be crazy to add it as
match-pred(icate) right next to match-lambda, match-let, and friends (
http://docs.racket-lang.org/reference/match.html?q=match&q=match-pred#(form._((lib._racket/match..rkt)._match-lambda))
).

Then, for rackunit, it's just up to how much we like writing

(check-match foo P)

vs.

(check-pred (match-pred P) foo)

Both seem handy to me.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/dev/archive/attachments/20121119/400281fa/attachment-0001.html>

Posted on the dev mailing list.