From cf99c8acf35315b7d4d66761e7ea7ac9bdd4f4c8 Mon Sep 17 00:00:00 2001 From: Sergiu Ivanov Date: Tue, 3 Mar 2020 00:25:06 +0100 Subject: [PATCH] rs: Add pretty-print-state and use it in update-graph. --- rs.rkt | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/rs.rkt b/rs.rkt index 96cc2ec..16e0c54 100644 --- a/rs.rkt +++ b/rs.rkt @@ -173,9 +173,15 @@ (dds-build-state-graph-annotated (dynamics rs) (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. (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. (define-syntax-rule (ppsg sgr) (pretty-print-state-graph sgr))