Flatten actions, to permit '() and lists of actions

This commit is contained in:
Tony Garnock-Jones 2012-01-13 21:19:10 -05:00
parent 37f242874b
commit 3c1c36facc
1 changed files with 3 additions and 2 deletions

View File

@ -4,6 +4,7 @@
(require racket/set) (require racket/set)
(require racket/match) (require racket/match)
(require racket/list)
(require "os.rkt") (require "os.rkt")
(provide (struct-out subscribe) (provide (struct-out subscribe)
@ -51,7 +52,7 @@
;; -- a (transition WorldState ListOf<Action>) or ;; -- a (transition WorldState ListOf<Action>) or
;; -- a WorldState ;; -- a WorldState
(struct transition (state actions) #:transparent) (struct transition (state actions) #:transparent)
(define (make-transition state . actions) (transition state actions)) (define (make-transition state . actions) (transition state (flatten actions)))
;; A World is a (world WorldState Map<SID,Set<EventDescription>>), a ;; A World is a (world WorldState Map<SID,Set<EventDescription>>), a
;; representation of a suspended world and its active subscriptions. ;; representation of a suspended world and its active subscriptions.
@ -124,4 +125,4 @@
(define (os-big-bang initial-state . initial-actions) (define (os-big-bang initial-state . initial-actions)
(lambda () (lambda ()
(transition->os-transition (world (void) (hash)) (transition->os-transition (world (void) (hash))
(transition initial-state initial-actions)))) (transition initial-state (flatten initial-actions)))))