diff --git a/rs.rkt b/rs.rkt index 07f5a89..71174f1 100644 --- a/rs.rkt +++ b/rs.rkt @@ -9,6 +9,8 @@ str-triple->reaction ht-str-triples->rs read-org-rs read-context-sequence reaction->str-triple rs->ht-str-triples + + (struct-out state) State ) (module+ test @@ -167,6 +169,11 @@ (define rs (hash 'a (make-reaction '(x) '(y) '(z)) 'b (make-reaction '(x y) '() '(t)))) (rs->ht-str-triples rs))) + + (struct state ([result : (Setof Species)] + [rest-contexts : (Listof (Setof Species))]) + #:transparent + #:type-name State) ) (require graph "utils.rkt" "generic.rkt") diff --git a/scribblings/rs.scrbl b/scribblings/rs.scrbl index ddf394b..419637f 100644 --- a/scribblings/rs.scrbl +++ b/scribblings/rs.scrbl @@ -194,3 +194,23 @@ system starts with the initial context. Then, at every step, the result of applying the reaction system is merged with the next element of the context sequence, and the reaction system is then applied to the result of the union. If the sequence of contexts is empty, the reaction system cannot evolve. + +@defstruct*[state ([result (Setof Species)] + [rest-contexts (Listof (Setof Species))])]{ + +A state of a reaction system is a set of species representing the +result of the application of the reactions from the previous steps +(the field @racket[result]), plus the rest of the context sequence +(the field @racket[rest-contexts]). + +The length of @racket[rest-contexts] dictates for how many steps the +reaction system will be run. If it is empty, no more reactions will +be applied. + +} + +@deftype[State]{ + +The type of the instances of @racket[state]. + +}