Type str-triple->reaction.
This commit is contained in:
parent
a51bba870e
commit
e884a2ee07
2 changed files with 25 additions and 1 deletions
17
rs.rkt
17
rs.rkt
|
@ -5,7 +5,10 @@
|
||||||
|
|
||||||
(provide
|
(provide
|
||||||
Species (struct-out reaction) Reaction ReactionName ReactionSystem
|
Species (struct-out reaction) Reaction ReactionName ReactionSystem
|
||||||
make-reaction enabled? list-enabled union-products apply-rs)
|
make-reaction enabled? list-enabled union-products apply-rs
|
||||||
|
|
||||||
|
str-triple->reaction
|
||||||
|
)
|
||||||
|
|
||||||
(module+ test
|
(module+ test
|
||||||
(require typed/rackunit))
|
(require typed/rackunit))
|
||||||
|
@ -91,6 +94,18 @@
|
||||||
(set 't))
|
(set 't))
|
||||||
(check-equal? (apply-rs rs (set 'x))
|
(check-equal? (apply-rs rs (set 'x))
|
||||||
(set 'z))))
|
(set 'z))))
|
||||||
|
|
||||||
|
(: str-triple->reaction (-> (List String String String) Reaction))
|
||||||
|
(define/match (str-triple->reaction lst)
|
||||||
|
[((list str-reactants str-inhibitors str-products))
|
||||||
|
(reaction (list->set (read-symbol-list str-reactants))
|
||||||
|
(list->set (read-symbol-list str-inhibitors))
|
||||||
|
(list->set (read-symbol-list str-products)))])
|
||||||
|
|
||||||
|
(module+ test
|
||||||
|
(test-case "str-triple->reaction"
|
||||||
|
(check-equal? (str-triple->reaction '("a b" "c d" "e f"))
|
||||||
|
(reaction (set 'b 'a) (set 'c 'd) (set 'f 'e)))))
|
||||||
)
|
)
|
||||||
|
|
||||||
(require graph "utils.rkt" "generic.rkt")
|
(require graph "utils.rkt" "generic.rkt")
|
||||||
|
|
|
@ -129,6 +129,15 @@ Applies the reaction system @racket[rs] to @racket[s].
|
||||||
This section contains some useful primitives for
|
This section contains some useful primitives for
|
||||||
@hyperlink["https://orgmode.org/"]{Org-mode} interoperability.
|
@hyperlink["https://orgmode.org/"]{Org-mode} interoperability.
|
||||||
|
|
||||||
|
@defproc[(str-triple->reaction [lst (List String String String)]) Reaction]{
|
||||||
|
|
||||||
|
Converts a triple of strings to a reaction.
|
||||||
|
|
||||||
|
@ex[
|
||||||
|
(str-triple->reaction '("a b" "c d" "e f"))
|
||||||
|
]}
|
||||||
|
|
||||||
|
|
||||||
@section{Dynamics of reaction systems}
|
@section{Dynamics of reaction systems}
|
||||||
|
|
||||||
The dynamics of reaction systems is typically defined as @emph{interaction
|
The dynamics of reaction systems is typically defined as @emph{interaction
|
||||||
|
|
Loading…
Reference in a new issue