networks: Add tbf/state-tabulate.
This commit is contained in:
parent
f37155fd3e
commit
848d53f97a
1 changed files with 17 additions and 1 deletions
16
networks.rkt
16
networks.rkt
|
@ -91,6 +91,8 @@
|
|||
[print-org-tbfs/state (->* ((non-empty-listof tbf/state?)) (#:headers boolean?)
|
||||
(listof (listof (or/c number? symbol?))))]
|
||||
[tbf/state-tabulate* (->* ((non-empty-listof tbf/state?)) (#:headers boolean?)
|
||||
(listof (listof (or/c symbol? number?))))]
|
||||
[tbf/state-tabulate (->* (tbf/state?) (#:headers boolean?)
|
||||
(listof (listof (or/c symbol? number?))))])
|
||||
;; Predicates
|
||||
(contract-out [variable? (-> any/c boolean?)]
|
||||
|
@ -1117,5 +1119,19 @@
|
|||
(1 0 0 0)
|
||||
(1 1 1 0)))))
|
||||
|
||||
;;; Like tbf/state-tabulate*, but only tabulates a single TBF.
|
||||
(define (tbf/state-tabulate tbf #:headers [headers #t])
|
||||
(tbf/state-tabulate* (list tbf) #:headers headers))
|
||||
|
||||
(module+ test
|
||||
(test-case "tbf/state-tabulate"
|
||||
(define tbf (make-tbf/state '((a . -2) (b . 3)) 1))
|
||||
(check-equal? (tbf/state-tabulate tbf)
|
||||
'((a b f1)
|
||||
(0 0 0)
|
||||
(0 1 1)
|
||||
(1 0 0)
|
||||
(1 1 0)))))
|
||||
|
||||
;;; A TBN is a network form mapping TBFs to variables.
|
||||
(define tbn? (hash/c variable? tbf?))
|
||||
|
|
Loading…
Reference in a new issue