diff --git a/networks.rkt b/networks.rkt index fa1025e..fde16b8 100644 --- a/networks.rkt +++ b/networks.rkt @@ -91,7 +91,9 @@ [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?))))]) + (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?)] [state? (-> 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?))