Type read-org-rs.
This commit is contained in:
parent
aae2e1f964
commit
6a9adf5e07
2 changed files with 22 additions and 1 deletions
15
rs.rkt
15
rs.rkt
|
@ -7,7 +7,7 @@
|
||||||
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 ht-str-triples->rs
|
str-triple->reaction ht-str-triples->rs read-org-rs
|
||||||
)
|
)
|
||||||
|
|
||||||
(module+ test
|
(module+ test
|
||||||
|
@ -120,6 +120,19 @@
|
||||||
'b (list "" "x y" "t j")))
|
'b (list "" "x y" "t j")))
|
||||||
(hash 'a (reaction (set 'y 'x) (set) (set 'k 'i))
|
(hash 'a (reaction (set 'y 'x) (set) (set 'k 'i))
|
||||||
'b (reaction (set) (set 'y 'x) (set 't 'j))))))
|
'b (reaction (set) (set 'y 'x) (set 't 'j))))))
|
||||||
|
|
||||||
|
(: read-org-rs (-> String ReactionSystem))
|
||||||
|
(define (read-org-rs str)
|
||||||
|
(ht-str-triples->rs
|
||||||
|
(assert-type (read-org-variable-mapping str)
|
||||||
|
(Immutable-HashTable ReactionName (List String String String)))))
|
||||||
|
|
||||||
|
(module+ test
|
||||||
|
(test-case "read-org-rs"
|
||||||
|
(check-equal?
|
||||||
|
(read-org-rs "((\"a\" \"x t\" \"y\" \"z\") (\"b\" \"x\" \"q\" \"z\"))")
|
||||||
|
(hash 'a (reaction (set 't 'x) (set 'y) (set 'z))
|
||||||
|
'b (reaction (set 'x) (set 'q) (set 'z))))))
|
||||||
)
|
)
|
||||||
|
|
||||||
(require graph "utils.rkt" "generic.rkt")
|
(require graph "utils.rkt" "generic.rkt")
|
||||||
|
|
|
@ -148,6 +148,14 @@ a reaction system.
|
||||||
'b (list "" "x y" "t j")))
|
'b (list "" "x y" "t j")))
|
||||||
]}
|
]}
|
||||||
|
|
||||||
|
@defproc[(read-org-rs [str String]) ReactionSystem]{
|
||||||
|
|
||||||
|
Reads a reaction system from an Org-mode style string.
|
||||||
|
|
||||||
|
@ex[
|
||||||
|
(read-org-rs "((\"a\" \"x t\" \"y\" \"z\") (\"b\" \"x\" \"q\" \"z\"))")
|
||||||
|
]}
|
||||||
|
|
||||||
|
|
||||||
@section{Dynamics of reaction systems}
|
@section{Dynamics of reaction systems}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue