commit 2d6ecae8c4a24a96d0d330868fa1ecb58a3b0673 parent 61ad998c7a3f8d8c9b810ae70f860c4a1b5dcace Author: Milo <iitalics@gmail.com> Date: Mon, 24 Jul 2017 11:11:56 -0400 added #:mode and #:modes premise syntax (#16) Diffstat:
| M | turnstile/turnstile.rkt | | | 14 | ++++++++++++++ |
1 file changed, 14 insertions(+), 0 deletions(-)
diff --git a/turnstile/turnstile.rkt b/turnstile/turnstile.rkt @@ -317,6 +317,20 @@ [pattern (~seq #:fail-unless condition:expr message:expr) #:with pat #'(~post (~fail #:unless condition message))] + [pattern (~seq #:mode param:id value:expr (sub-clause:clause ...)) + #:with tmp (generate-temporary #'param) + #:with pat + #'(~and (~do (define tmp [param]) + [param value]) + sub-clause.pat ... + (~do [param tmp]))] + [pattern (~seq #:modes ([param:id value:expr] ...) (sub-clause:clause ...)) + #:with (tmp ...) (generate-temporary #'[param ...]) + #:with pat + #'(~and (~do (define tmp [param]) ... + [param value] ...) + sub-clause.pat ... + (~do [param tmp] ...))] ) (define-syntax-class last-clause #:datum-literals (⊢ ≫ ≻ ⇒ ⇐)