rs: Add pretty-print-state and use it in update-graph.
This commit is contained in:
parent
f22d42f98c
commit
cf99c8acf3
1 changed files with 7 additions and 1 deletions
8
rs.rkt
8
rs.rkt
|
@ -173,9 +173,15 @@
|
||||||
(dds-build-state-graph-annotated (dynamics rs)
|
(dds-build-state-graph-annotated (dynamics rs)
|
||||||
(set (state (set) contexts))))
|
(set (state (set) contexts))))
|
||||||
|
|
||||||
|
;;; Pretty-prints the context and the current result of a state of the
|
||||||
|
;;; reaction system.
|
||||||
|
(define/match (pretty-print-state st)
|
||||||
|
[((state res ctx))
|
||||||
|
(format "C:~a\nD:{~a}" (pretty-print-set-sets ctx) (pretty-print-set res))])
|
||||||
|
|
||||||
;;; Pretty prints the state graph of a reaction system.
|
;;; Pretty prints the state graph of a reaction system.
|
||||||
(define (pretty-print-state-graph sgr)
|
(define (pretty-print-state-graph sgr)
|
||||||
(update-graph sgr #:e-func pretty-print-set-sets))
|
(update-graph sgr #:v-func pretty-print-state #:e-func pretty-print-set-sets))
|
||||||
|
|
||||||
;;; A shortcut for pretty-print-state-graph.
|
;;; A shortcut for pretty-print-state-graph.
|
||||||
(define-syntax-rule (ppsg sgr) (pretty-print-state-graph sgr))
|
(define-syntax-rule (ppsg sgr) (pretty-print-state-graph sgr))
|
||||||
|
|
Loading…
Reference in a new issue