diff --git a/functions.rkt b/functions.rkt index de6df99..b38d1d6 100644 --- a/functions.rkt +++ b/functions.rkt @@ -30,7 +30,7 @@ random-boolean-table random-boolean-function random-boolean-function/list (struct-out tbf) tbf-w tbf-θ boolean->01/vector apply-tbf apply-tbf/boolean - list->tbf lists->tbfs read-org-tbfs tbf-tabulate*) + list->tbf lists->tbfs read-org-tbfs tbf-tabulate* tbf-tabulate) (module+ test (require typed/rackunit)) @@ -515,6 +515,15 @@ (check-equal? (tbf-tabulate* (list (tbf #(2 2) 1) (tbf #(1 1) 1))) '((0 0 0 0) (0 1 1 0) (1 0 1 0) (1 1 1 1))))) + (: tbf-tabulate (-> tbf (Listof (Listof (U Zero One))))) + (define (tbf-tabulate t) + (tbf-tabulate* (list t))) + + (module+ test + (test-case "tbf-tabulate" + (check-equal? (tbf-tabulate (tbf #(1 2) 1)) + '((0 0 0) (0 1 1) (1 0 0) (1 1 1))))) + (module untyped racket (module+ test (require rackunit)) @@ -604,7 +613,7 @@ random-boolean-table random-boolean-function random-boolean-function/list (struct-out tbf) tbf-w tbf-θ boolean->01/vector apply-tbf apply-tbf/boolean - list->tbf lists->tbfs read-org-tbfs tbf-tabulate*) + list->tbf lists->tbfs read-org-tbfs tbf-tabulate* tbf-tabulate) (require (rename-in (submod 'typed untyped) [tabulate tabulate/untyped] @@ -613,7 +622,6 @@ (provide ;; Functions (contract-out - [tbf-tabulate (-> tbf? (listof (listof (or/c 0 1))))] [tbf-tabulate*/boolean (-> (listof tbf?) (listof (listof boolean?)))] [sbf (-> (vectorof number?) tbf?)] [list->sbf (-> (listof number?) sbf?)] @@ -630,15 +638,6 @@ ;;; Threshold Boolean functions ;;; =========================== - -;;; Tabulates a TBF. -(define tbf-tabulate (compose tbf-tabulate* list)) - -(module+ test - (test-case "tbf-tabulate" - (check-equal? (tbf-tabulate (tbf #(1 2) 1)) - '((0 0 0) (0 1 1) (1 0 0) (1 1 1))))) - ;;; Tabulates a list of TBFs like tbf-boolean*, but uses Boolean ;;; values #f and #t instead of 0 and 1. ;;; diff --git a/scribblings/functions.scrbl b/scribblings/functions.scrbl index 37aa262..790d5f2 100644 --- a/scribblings/functions.scrbl +++ b/scribblings/functions.scrbl @@ -543,6 +543,15 @@ TBF in the list. (tbf-tabulate* (list (tbf #(2 2) 1) (tbf #(1 1) 1))) ]} +@defproc[(tbf-tabulate [t tbf]) + (Listof (Listof (U Zero One)))]{ + +Tabulates a single TBF. + +@ex[ +(tbf-tabulate (tbf #(1 2) 1)) +]} + @section[#:tag "fuctions/untyped"]{Untyped definitions} @defmodule[(submod dds/functions typed untyped)]