diff --git a/scribblings/tbn.scrbl b/scribblings/tbn.scrbl index 21ff8c6..464cb88 100644 --- a/scribblings/tbn.scrbl +++ b/scribblings/tbn.scrbl @@ -228,6 +228,23 @@ corresponds to the column giving the thresholds of the TBFs. (tbf/state (hash 'a -2 'b 1) 1))) ]} +@defproc[(sbfs/state->lists [sbfs (Listof TBF/State)]) + (Listof (Listof Real))]{ + +Like @racket[tbfs/state->lists], but the thresholds are omitted. + +@ex[ +(sbfs/state->lists (list (tbf/state (hash 'a 1 'b 2) 0) + (tbf/state (hash 'a -2 'b 1) 0))) +] + +Note that this function just drops the threshold, without checking +whether it is actually 0: + +@ex[ +(sbfs/state->lists (list (tbf/state (hash 'a 1 'b 2) 3))) +]} + @section{Tabulating TBFs and SBFs} @defproc[(tabulate-tbfs/state [tbfs (Listof TBF/State)]) (Listof (Listof Real))]{ diff --git a/tbn.rkt b/tbn.rkt index 52fa27e..3ea212d 100644 --- a/tbn.rkt +++ b/tbn.rkt @@ -29,6 +29,7 @@ lists+vars->sbfs/state lists+headers->sbfs/state lists->sbfs/state read-org-tbfs/state read-org-tbfs/state+headers tbfs/state->lists tbfs/state->lists+headers + sbfs/state->lists tabulate-tbfs/state tabulate-tbfs/state+headers tabulate-tbf/state tabulate-tbf/state+headers @@ -224,15 +225,14 @@ (: sbfs/state->lists (-> (Listof TBF/State) (Listof (Listof Real)))) (define (sbfs/state->lists tbfs) (for/list ([tbf (in-list tbfs)]) - (append (hash-map (tbf/state-w tbf) (λ (_ [w : Real]) w) #t) - (list (tbf/state-θ tbf))))) + (hash-map (tbf/state-w tbf) (λ (_ [w : Real]) w) #t))) (module+ test - (test-case "tbfs/state->lists" + (test-case "sbfs/state->lists" (check-equal? - (tbfs/state->lists (list (tbf/state (hash 'a 1 'b 2) 3) - (tbf/state (hash 'a -2 'b 1) 1))) - '((1 2 3) (-2 1 1))))) + (sbfs/state->lists (list (tbf/state (hash 'a 1 'b 2) 0) + (tbf/state (hash 'a -2 'b 1) 0))) + '((1 2) (-2 1))))) (: tabulate-tbfs/state (-> (Listof TBF/State) (Listof (Listof Real)))) (define (tabulate-tbfs/state tbfs)