example: Illustrate printing TBN and SBN to Org tables.

This commit is contained in:
Sergiu Ivanov 2020-11-04 00:07:08 +01:00
parent 79d3ab1ea6
commit a7a1ad49a1
1 changed files with 31 additions and 0 deletions

View File

@ -1077,6 +1077,37 @@ tab
[[file:dots/sbn-figure2-sg.svg]]
:end:
You can print TBNs using =print-org-tbn= in the following way:
#+BEGIN_SRC racket :results table drawer :var sbn-figure2=munch-sexp(sbn-figure2)
(print-org-tbn (read-org-sbn sbn-figure2))
#+END_SRC
#+RESULTS:
:results:
| - | A | B | C | θ |
| A | -1 | 1 | 2 | 0 |
| B | 2 | -2 | -2 | 0 |
| C | -1 | 2 | -1 | 0 |
:end:
For convenience, =dds= also includes =print-org-sbn=, which allows
you to chop off the threshold column, which only contains zeros
anyway for the case of SBN:
#+BEGIN_SRC racket :results table drawer :var sbn-figure2=munch-sexp(sbn-figure2)
(print-org-sbn (read-org-sbn sbn-figure2))
#+END_SRC
#+RESULTS:
:results:
| - | A | B | C |
| A | -1 | 1 | 2 |
| B | 2 | -2 | -2 |
| C | -1 | 2 | -1 |
:end:
* Reaction systems
:PROPERTIES:
:header-args:racket: :prologue "#lang racket\n(require graph dds/rs dds/utils)"