example: Update Tabulating functions and networks.

This commit is contained in:
Sergiu Ivanov 2020-11-26 23:26:53 +01:00
parent 83deda31a9
commit a1085d50b8
1 changed files with 9 additions and 9 deletions

View File

@ -649,14 +649,14 @@ tab
#+END_SRC
#+RESULTS:
:RESULTS:
:results:
| 1 | 0 | 1 |
| 1 | 2 | 3 |
| 1 | 4 | 5 |
| 2 | 0 | 2 |
| 2 | 2 | 4 |
| 2 | 4 | 6 |
:END:
:end:
Here's how you tabulate a Boolean function:
#+BEGIN_SRC racket :results table drawer
@ -664,12 +664,12 @@ tab
#+END_SRC
#+RESULTS:
:RESULTS:
:results:
| #f | #f | #f |
| #f | #t | #f |
| #t | #f | #f |
| #t | #t | #t |
:END:
:end:
You can tabulate multiple functions taking the same arguments over
the same domains together.
@ -678,21 +678,21 @@ tab
#+END_SRC
#+RESULTS:
:RESULTS:
:results:
| #f | #f | #f | #f |
| #f | #t | #f | #t |
| #t | #f | #f | #t |
| #t | #t | #t | #t |
:END:
:end:
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 (network-form->network (unorgv in-bn)))
(tabulate-network (forms->boolean-network (unorgv in-bn)))
#+END_SRC
#+RESULTS:
:RESULTS:
:results:
| a | b | c | f-a | f-b | f-c |
| #f | #f | #f | #f | #f | #t |
| #f | #f | #t | #f | #t | #f |
@ -702,7 +702,7 @@ tab
| #t | #f | #t | #f | #f | #f |
| #t | #t | #f | #t | #f | #t |
| #t | #t | #t | #t | #f | #f |
:END:
:end:
** Random functions and networks
To avoid having different results every time a code block in this