Type reaction->str-triple.
This commit is contained in:
parent
c1723066a7
commit
a469eae764
2 changed files with 20 additions and 0 deletions
12
rs.rkt
12
rs.rkt
|
@ -8,6 +8,7 @@
|
|||
make-reaction enabled? list-enabled union-products apply-rs
|
||||
|
||||
str-triple->reaction ht-str-triples->rs read-org-rs read-context-sequence
|
||||
reaction->str-triple
|
||||
)
|
||||
|
||||
(module+ test
|
||||
|
@ -143,6 +144,17 @@
|
|||
(test-case "read-context-sequence"
|
||||
(check-equal? (read-context-sequence "((\"x y\") (\"z\") (\"\") (\"t\"))")
|
||||
(list (set 'x 'y) (set 'z) (set) (set 't)))))
|
||||
|
||||
(: reaction->str-triple (-> Reaction (Listof String)))
|
||||
(define/match (reaction->str-triple r)
|
||||
[((reaction r i p))
|
||||
(for/list ([c (in-list (list r i p))])
|
||||
(drop-first-last (any->string (set->list c))))])
|
||||
|
||||
(module+ test
|
||||
(test-case "reaction->str-triple"
|
||||
(check-equal? (reaction->str-triple (make-reaction '(x y) '(z t) '(k i)))
|
||||
'("x y" "z t" "i k"))))
|
||||
)
|
||||
|
||||
(require graph "utils.rkt" "generic.rkt")
|
||||
|
|
|
@ -165,6 +165,14 @@ containing a list, which may be produced by Org-mode.
|
|||
(read-context-sequence "((\"x y\") (\"z\") (\"\") (\"t\"))")
|
||||
]}
|
||||
|
||||
@defproc[(reaction->str-triple [r Reaction]) (Listof String)]{
|
||||
|
||||
Converts a reaction to a triple of strings.
|
||||
|
||||
@ex[
|
||||
(reaction->str-triple (make-reaction '(x y) '(z t) '(k i)))
|
||||
]}
|
||||
|
||||
|
||||
@section{Dynamics of reaction systems}
|
||||
|
||||
|
|
Loading…
Reference in a new issue