Match state rather than straight binding it
This commit is contained in:
parent
b96114f774
commit
37f242874b
|
@ -59,17 +59,19 @@
|
|||
|
||||
(define-syntax message-handlers
|
||||
(syntax-rules ()
|
||||
((_ old-state [pattern body ...] ...)
|
||||
((_ old-state-pattern [pattern body ...] ...)
|
||||
(on-message (match-lambda [pattern #t] ... [_ #f])
|
||||
(lambda (message old-state)
|
||||
(match-define old-state-pattern old-state)
|
||||
(match message
|
||||
[pattern body ...] ...))))))
|
||||
|
||||
(define-syntax meta-message-handler
|
||||
(syntax-rules (=>)
|
||||
((_ old-state [(raw-pattern => pattern) body ...])
|
||||
((_ old-state-pattern [(raw-pattern => pattern) body ...])
|
||||
(on-meta-message raw-pattern
|
||||
(lambda (meta-message old-state)
|
||||
(match-define old-state-pattern old-state)
|
||||
(match meta-message
|
||||
[pattern body ...]))))))
|
||||
|
||||
|
|
Loading…
Reference in New Issue