From 1c88d86472d503d3ae452829e2f6a75cdaaac4cf Mon Sep 17 00:00:00 2001 From: Tony Garnock-Jones Date: Fri, 6 Mar 2015 13:24:04 +0000 Subject: [PATCH] matcher-project/set, matcher-project/set/single --- prospect/route.rkt | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/prospect/route.rkt b/prospect/route.rkt index e86cf17..6b32ba0 100644 --- a/prospect/route.rkt +++ b/prospect/route.rkt @@ -40,6 +40,8 @@ matcher-project matcher-key-set matcher-key-set/single + matcher-project/set + matcher-project/set/single ;; Printing and Serialization pretty-print-matcher @@ -764,6 +766,14 @@ (define vss (matcher-key-set m)) (and vss (for/set [(vs (in-set vss))] (car vs)))) +;; Convenience forms for the common operation of projecting a Matcher +;; followed by converting the result to a Racket set (possibly +;; containing just the first captured subvalue). +(define-syntax-rule (matcher-project/set arg ...) + (matcher-key-set (matcher-project arg ...))) +(define-syntax-rule (matcher-project/set/single arg ...) + (matcher-key-set/single (matcher-project arg ...))) + ;; struct-type -> Symbol ;; Extract just the name of the given struct-type. (define (struct-type-name st)