Introduce "?" as identifier-syntax for "(wild)"
This commit is contained in:
parent
412ac6496b
commit
0c07fb3b0e
|
@ -54,10 +54,8 @@
|
|||
(cout (term->bytes
|
||||
`(,who ,did-what))))))
|
||||
(list
|
||||
(role (topic-publisher
|
||||
`(,me says ,(wild))))
|
||||
(role (topic-subscriber
|
||||
`(,(wild) says ,(wild)))
|
||||
(role (topic-publisher `(,me says ,?)))
|
||||
(role (topic-subscriber `(,? says ,?))
|
||||
#:topic t
|
||||
#:on-presence (announce t 'arrived)
|
||||
#:on-absence (announce t 'departed)
|
||||
|
|
|
@ -18,8 +18,8 @@
|
|||
(match-define (topic _ (tcp-channel connection-id _ _) _) t)
|
||||
(define-values (cin cout in-topic out-topic) (tcp-accept t))
|
||||
(transition 'no-state
|
||||
(role (topic-publisher `(,connection-id says ,(wild))))
|
||||
(role (topic-subscriber `(,(wild) says ,(wild)))
|
||||
(role (topic-publisher `(,connection-id says ,?)))
|
||||
(role (topic-subscriber `(,? says ,?))
|
||||
#:topic t
|
||||
#:on-presence (match t [(topic _ (list who _ _) _)
|
||||
(unless (equal? who connection-id)
|
||||
|
|
6
os2.rkt
6
os2.rkt
|
@ -77,6 +77,9 @@
|
|||
non-wild?
|
||||
ground?
|
||||
|
||||
;; Identifier-syntax for (wild)
|
||||
?
|
||||
|
||||
;; Reexports from racket/match for convenience
|
||||
(all-from-out racket/match)
|
||||
|
||||
|
@ -294,6 +297,9 @@
|
|||
(define-syntax-rule (yield-macro #:state state-pattern body ...)
|
||||
(yield (match-lambda [state-pattern body ...])))
|
||||
|
||||
;; A fresh unification variable, as identifier-syntax.
|
||||
(define-syntax ? (syntax-id-rules () (_ (wild))))
|
||||
|
||||
;;---------------------------------------------------------------------------
|
||||
;; Smarter constructors for transitions and preactions.
|
||||
|
||||
|
|
Loading…
Reference in New Issue