#lang racket

(require redex)
(require (for-syntax syntax/parse))

(define-syntax (r-r/tick stx)
  (syntax-parse stx
    [(_ PL #:domain x #:initial go #:observe o #:update u ((~literal -->) lhs 
rhs) ...)
     #'(let ((clock (go)))
         (reduction-relation
          PL
          #:domain x
          (--> lhs rhs (where _ ,(begin (set! clock (u clock)) (o clock))))
          ...))]))

; -----------------------------------------------------------------------------
        
(define-language X
  (e ::= a b c))

(define go
  (r-r/tick
   X
   #:domain e
   #:initial (lambda () (random 100))
   #:observe (lambda (clock) (displayln `(the clock is ,clock)))
   #:update  (curry + 3)
   (--> a b)
   (--> b c)
   (--> c a)))

(traces go (term a))

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to