example: Show how to apply reaction systems.
This commit is contained in:
parent
77c0106ea2
commit
db88987c13
1 changed files with 21 additions and 0 deletions
|
@ -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:
|
||||||
|
|
Loading…
Reference in a new issue