rs: Remove macros, update example.

This commit is contained in:
Sergiu Ivanov 2020-03-24 23:22:20 +01:00
parent 4c6f3af2a9
commit 14688a9bae
2 changed files with 8 additions and 10 deletions

View file

@ -589,7 +589,7 @@ tab
Here is how we read this reaction into Racket code: Here is how we read this reaction into Racket code:
#+BEGIN_SRC racket :results output drawer :var input-rs=munch-sexp(rs1) #+BEGIN_SRC racket :results output drawer :var input-rs=munch-sexp(rs1)
(unorg-rs input-rs) (read-org-rs input-rs)
#+END_SRC #+END_SRC
#+RESULTS: #+RESULTS:
@ -599,7 +599,7 @@ tab
Here is how we can put it back into an Org-mode table: Here is how we can put it back into an Org-mode table:
#+BEGIN_SRC racket :results table drawer :var input-rs=munch-sexp(rs1) #+BEGIN_SRC racket :results table drawer :var input-rs=munch-sexp(rs1)
(org-rs (unorg-rs input-rs)) (rs->ht-str-triples (read-org-rs input-rs))
#+END_SRC #+END_SRC
#+RESULTS: #+RESULTS:
@ -610,7 +610,7 @@ tab
Here is how we can apply this reaction system to a state: Here is how we can apply this reaction system to a state:
#+BEGIN_SRC racket :results output drawer :var input-rs=munch-sexp(rs1) #+BEGIN_SRC racket :results output drawer :var input-rs=munch-sexp(rs1)
(let ([rs (unorg-rs input-rs)]) (let ([rs (read-org-rs input-rs)])
(apply-rs rs (set 'x 't))) (apply-rs rs (set 'x 't)))
#+END_SRC #+END_SRC
@ -621,7 +621,7 @@ tab
Let's see which reactions got applied: Let's see which reactions got applied:
#+BEGIN_SRC racket :results list :var input-rs=munch-sexp(rs1) #+BEGIN_SRC racket :results list :var input-rs=munch-sexp(rs1)
(let ([rs (unorg-rs input-rs)]) (let ([rs (read-org-rs input-rs)])
(list-enabled rs (set 'x 't))) (list-enabled rs (set 'x 't)))
#+END_SRC #+END_SRC
@ -638,7 +638,7 @@ tab
- t - t
#+BEGIN_SRC racket :results output drawer :var input-ctx=munch-sexp(ctx1) #+BEGIN_SRC racket :results output drawer :var input-ctx=munch-sexp(ctx1)
(read-ctx input-ctx) (read-context-sequence input-ctx)
#+END_SRC #+END_SRC
#+RESULTS: #+RESULTS:
@ -652,7 +652,7 @@ tab
#+NAME: rs1-sgr #+NAME: rs1-sgr
#+HEADER: :var input-rs=munch-sexp(rs1) :var input-ctx=munch-sexp(ctx1) #+HEADER: :var input-rs=munch-sexp(rs1) :var input-ctx=munch-sexp(ctx1)
#+BEGIN_SRC racket :results output drawer #+BEGIN_SRC racket :results output drawer
(dotit (ppsg (build-interactive-process-graph (unorg-rs input-rs) (read-ctx input-ctx)))) (dotit (pretty-print-state-graph (build-interactive-process-graph (read-org-rs input-rs) (read-context-sequence input-ctx))))
#+END_SRC #+END_SRC
#+RESULTS: rs1-sgr #+RESULTS: rs1-sgr
@ -696,7 +696,7 @@ tab
#+NAME: rs1-ip #+NAME: rs1-ip
#+HEADER: :var input-rs=munch-sexp(rs1) :var input-ctx=munch-sexp(ctx1) #+HEADER: :var input-rs=munch-sexp(rs1) :var input-ctx=munch-sexp(ctx1)
#+BEGIN_SRC racket :results table drawer #+BEGIN_SRC racket :results table drawer
(build-interactive-process (unorg-rs input-rs) (read-ctx input-ctx)) (build-interactive-process (read-org-rs input-rs) (read-context-sequence input-ctx))
#+END_SRC #+END_SRC
#+RESULTS: rs1-ip #+RESULTS: rs1-ip

4
rs.rkt
View file

@ -33,9 +33,7 @@
;; Predicates ;; Predicates
(contract-out [species? (-> any/c boolean?)]) (contract-out [species? (-> any/c boolean?)])
;; Contracts ;; Contracts
(contract-out [reaction-system/c contract?]) (contract-out [reaction-system/c contract?]))
;; Syntax
unorg-rs org-rs read-ctx ppsg)
;;; ================= ;;; =================
;;; Basic definitions ;;; Basic definitions