example: Explain new SBF-related additions.
This commit is contained in:
parent
2d1ef85209
commit
848142aa61
1 changed files with 48 additions and 0 deletions
|
@ -971,6 +971,54 @@ tab
|
|||
| 1 | 1 | 1 | 0 |
|
||||
:end:
|
||||
|
||||
=dds= also includes functions for dealing with SBF operating on
|
||||
states. In particular, to create an SBF, you can do:
|
||||
|
||||
#+BEGIN_SRC racket :results output drawer
|
||||
(make-sbf/state '((a . -1) (b . 1)))
|
||||
#+END_SRC
|
||||
|
||||
#+RESULTS:
|
||||
:results:
|
||||
(tbf/state '#hash((a . -1) (b . 1)) 0)
|
||||
:end:
|
||||
|
||||
Most of the functions operating on TBF can be directly applied to
|
||||
SBF and therefore have no specialization for this particular case.
|
||||
However, there are variants of reading and printing functions for
|
||||
SBF.
|
||||
|
||||
Consider the following table giving the weights of two SBF:
|
||||
|
||||
#+NAME: simple-sbfs/state
|
||||
| a | b |
|
||||
| 1 | 1 |
|
||||
| -2 | 1 |
|
||||
|
||||
You can read these SBFs in the following way:
|
||||
|
||||
#+BEGIN_SRC racket :results output drawer :var simple-sbfs/state=munch-sexp(simple-sbfs/state)
|
||||
(read-org-sbfs/state simple-sbfs/state)
|
||||
#+END_SRC
|
||||
|
||||
#+RESULTS:
|
||||
:results:
|
||||
(list (tbf/state '#hash((a . 1) (b . 1)) 0) (tbf/state '#hash((a . -2) (b . 1)) 0))
|
||||
:end:
|
||||
|
||||
You can print them back to an Org-mode table as follows:
|
||||
|
||||
#+BEGIN_SRC racket :results table drawer :var simple-sbfs/state=munch-sexp(simple-sbfs/state)
|
||||
(print-org-sbfs/state (read-org-sbfs/state simple-sbfs/state))
|
||||
#+END_SRC
|
||||
|
||||
#+RESULTS:
|
||||
:results:
|
||||
| a | b |
|
||||
| 1 | 1 |
|
||||
| -2 | 1 |
|
||||
:end:
|
||||
|
||||
* Reaction systems
|
||||
:PROPERTIES:
|
||||
:header-args:racket: :prologue "#lang racket\n(require graph dds/rs dds/utils)"
|
||||
|
|
Loading…
Reference in a new issue