example: Show how to apply reaction systems.

This commit is contained in:
Sergiu Ivanov 2020-03-01 21:14:18 +01:00
parent 77c0106ea2
commit db88987c13

View file

@ -498,6 +498,27 @@ tab
| b | "x" | "q" | "z" | | b | "x" | "q" | "z" |
:END: :END:
Here is how we can apply this reaction system to a state:
#+BEGIN_SRC racket :results output drawer :var input-rs=munch-table(rs1)
(let ([rs (unorg-rs input-rs)])
(apply-rs rs (set 'x 't)))
#+END_SRC
#+RESULTS:
:RESULTS:
(set 'z)
:END:
Let's see which reactions got applied:
#+BEGIN_SRC racket :results list :var input-rs=munch-table(rs1)
(let ([rs (unorg-rs input-rs)])
(list-enabled rs (set 'x 't)))
#+END_SRC
#+RESULTS:
- a
- b
* Local Variables :noexport: * Local Variables :noexport:
# Local Variables: # Local Variables: