utils: unorg -> unorgv
This commit is contained in:
parent
62ae1e3af1
commit
a8a981098f
3 changed files with 19 additions and 19 deletions
|
@ -226,9 +226,9 @@ tab
|
|||
:END:
|
||||
|
||||
[[../utils.rkt][=dds/utils=]] has several functions for parsing such strings, and
|
||||
notably =read-org-variable-mapping=, with the shortcut =unorg=:
|
||||
notably =read-org-variable-mapping=, with the shortcut =unorgv=:
|
||||
#+BEGIN_SRC racket :results output drawer :var tab=munch-sexp(sexp=test-table)
|
||||
(unorg tab)
|
||||
(unorgv tab)
|
||||
#+END_SRC
|
||||
|
||||
#+RESULTS:
|
||||
|
@ -245,7 +245,7 @@ tab
|
|||
| c | (and a (not b)) |
|
||||
|
||||
#+BEGIN_SRC racket :results output drawer :var tab=munch-sexp(sexp=another-test-table)
|
||||
(unorg tab)
|
||||
(unorgv tab)
|
||||
#+END_SRC
|
||||
|
||||
#+RESULTS:
|
||||
|
@ -257,7 +257,7 @@ tab
|
|||
Some functions in =dds= build graphs:
|
||||
|
||||
#+BEGIN_SRC racket :results output drawer :var bf=munch-sexp(another-test-table)
|
||||
(build-interaction-graph (unorg bf))
|
||||
(build-interaction-graph (unorgv bf))
|
||||
#+END_SRC
|
||||
|
||||
#+RESULTS:
|
||||
|
@ -273,7 +273,7 @@ tab
|
|||
|
||||
#+NAME: igraph
|
||||
#+BEGIN_SRC racket :results output drawer :var bf=munch-sexp(another-test-table)
|
||||
(display (graphviz (build-interaction-graph (unorg bf))))
|
||||
(display (graphviz (build-interaction-graph (unorgv bf))))
|
||||
#+END_SRC
|
||||
|
||||
#+RESULTS: igraph
|
||||
|
@ -332,7 +332,7 @@ tab
|
|||
Here's the unsigned interaction graph of this network:
|
||||
#+NAME: simple-bn-ig
|
||||
#+BEGIN_SRC racket :results silent :var simple-bn=munch-sexp(simple-bn)
|
||||
(dotit (build-interaction-graph (unorg simple-bn)))
|
||||
(dotit (build-interaction-graph (unorgv simple-bn)))
|
||||
#+END_SRC
|
||||
|
||||
#+BEGIN_SRC dot :file dots/examplejTo8XT.svg :results raw drawer :cmd sfdp :noweb yes
|
||||
|
@ -348,7 +348,7 @@ tab
|
|||
|
||||
#+NAME: simple-bn-sig
|
||||
#+BEGIN_SRC racket :results silent :var simple-bn=munch-sexp(simple-bn)
|
||||
(dotit (build-boolean-signed-interaction-graph/form (unorg simple-bn)))
|
||||
(dotit (build-boolean-signed-interaction-graph/form (unorgv simple-bn)))
|
||||
#+END_SRC
|
||||
|
||||
#+BEGIN_SRC dot :file dots/exampledpQygl.svg :results raw drawer :cmd sfdp :noweb yes
|
||||
|
@ -369,7 +369,7 @@ tab
|
|||
dynamics:
|
||||
#+NAME: simple-bn-sg
|
||||
#+BEGIN_SRC racket :results silent :var simple-bn=munch-sexp(simple-bn)
|
||||
(let* ([bn (nn (unorg simple-bn))]
|
||||
(let* ([bn (nn (unorgv simple-bn))]
|
||||
[bn-asyn (make-asyn-dynamics bn)])
|
||||
(dotit (ppsg (build-full-boolean-state-graph bn-asyn))))
|
||||
#+END_SRC
|
||||
|
@ -388,7 +388,7 @@ tab
|
|||
of Boolean values as 0 and 1:
|
||||
#+NAME: simple-bn-sg-bool
|
||||
#+BEGIN_SRC racket :results silent :var simple-bn=munch-sexp(simple-bn)
|
||||
(let* ([bn (nn (unorg simple-bn))]
|
||||
(let* ([bn (nn (unorgv simple-bn))]
|
||||
[bn-asyn (make-asyn-dynamics bn)])
|
||||
(dotit (ppsgb (build-full-boolean-state-graph bn-asyn))))
|
||||
#+END_SRC
|
||||
|
@ -416,9 +416,9 @@ tab
|
|||
#+HEADER: :var simple-bn=munch-sexp(simple-bn)
|
||||
#+HEADER: :var some-state=munch-sexp(some-state)
|
||||
#+BEGIN_SRC racket :results silent
|
||||
(let* ([bn (nn (unorg simple-bn))]
|
||||
(let* ([bn (nn (unorgv simple-bn))]
|
||||
[bn-asyn (make-asyn-dynamics bn)]
|
||||
[s0 (stb (unorg some-state))])
|
||||
[s0 (stb (unorgv some-state))])
|
||||
(dotit (ppsgb (dds-build-n-step-state-graph bn-asyn (set s0) 2))))
|
||||
#+END_SRC
|
||||
|
||||
|
@ -435,7 +435,7 @@ tab
|
|||
modality leading to the update.
|
||||
#+NAME: simple-bn-sg-bool-ann
|
||||
#+BEGIN_SRC racket :results silent :var simple-bn=munch-sexp(simple-bn)
|
||||
(let* ([bn (nn (unorg simple-bn))]
|
||||
(let* ([bn (nn (unorgv simple-bn))]
|
||||
[bn-asyn (make-asyn-dynamics bn)])
|
||||
(dotit (ppsgb (build-full-boolean-state-graph-annotated bn-asyn))))
|
||||
#+END_SRC
|
||||
|
@ -457,7 +457,7 @@ tab
|
|||
|
||||
#+NAME: bn2-sgr
|
||||
#+BEGIN_SRC racket :results silent :var input-bn=munch-sexp(bn2)
|
||||
(let* ([bn (nn (unorg input-bn))]
|
||||
(let* ([bn (nn (unorgv input-bn))]
|
||||
[bn-asyn (make-asyn-dynamics bn)])
|
||||
(dotit (ppsgb (build-full-boolean-state-graph-annotated bn-asyn))))
|
||||
#+END_SRC
|
||||
|
@ -507,7 +507,7 @@ tab
|
|||
Here's how to tabulate the network =simple-bn=, defined at the top
|
||||
of this section:
|
||||
#+BEGIN_SRC racket :results table drawer :var in-bn=munch-sexp(simple-bn)
|
||||
(tabulate-boolean-network (nn (unorg in-bn)))
|
||||
(tabulate-boolean-network (nn (unorgv in-bn)))
|
||||
#+END_SRC
|
||||
|
||||
#+RESULTS:
|
||||
|
@ -539,8 +539,8 @@ tab
|
|||
Here's a random function taking values in the codomain =(4 5 6)=:
|
||||
#+BEGIN_SRC racket :results table drawer :var simple-domains=munch-sexp(simple-domains)
|
||||
(random-seed 0)
|
||||
(define rnd-func (random-function/state (unorg simple-domains) '(4 5 6)))
|
||||
(tabulate-state rnd-func (unorg simple-domains))
|
||||
(define rnd-func (random-function/state (unorgv simple-domains) '(4 5 6)))
|
||||
(tabulate-state rnd-func (unorgv simple-domains))
|
||||
#+END_SRC
|
||||
|
||||
#+RESULTS:
|
||||
|
|
|
@ -51,7 +51,7 @@
|
|||
'((a . 1) (b . (and a (not b)))))
|
||||
(let ([m1 (read-org-variable-mapping "((\"a\" \"(and a b)\") (\"b\" \"(or b (not a))\"))")]
|
||||
[m2 (read-org-variable-mapping "((\"a\" . \"(and a b)\") (\"b\" . \"(or b (not a))\"))")]
|
||||
[m3 (unorg "((\"a\" . \"(and a b)\") (\"b\" . \"(or b (not a))\"))")])
|
||||
[m3 (unorgv "((\"a\" . \"(and a b)\") (\"b\" . \"(or b (not a))\"))")])
|
||||
(check-equal? (hash-ref m1 'a) '(and a b))
|
||||
(check-equal? (hash-ref m2 'a) '(and a b))
|
||||
(check-equal? (hash-ref m3 'a) '(and a b))
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
[unstringify-pairs (-> (listof (general-pair/c string? any/c))
|
||||
(listof (general-pair/c symbol? any/c)))]
|
||||
[read-org-variable-mapping (-> string? variable-mapping?)]
|
||||
[unorg (-> string? variable-mapping?)]
|
||||
[unorgv (-> string? variable-mapping?)]
|
||||
[dotit (-> graph? void?)]
|
||||
[read-symbol-list (-> string? (listof symbol?))]
|
||||
[drop-first-last (-> string? string?)]
|
||||
|
@ -227,7 +227,7 @@
|
|||
(compose make-immutable-hash unstringify-pairs read-org-sexp))
|
||||
|
||||
;;; A synonym for read-org-variable-mapping.
|
||||
(define unorg read-org-variable-mapping)
|
||||
(define unorgv read-org-variable-mapping)
|
||||
|
||||
;;; Typeset the graph via graphviz and display it.
|
||||
(define dotit (compose display graphviz))
|
||||
|
|
Loading…
Reference in a new issue