diff --git a/functions.rkt b/functions.rkt index 76e792c..ebf6ff1 100644 --- a/functions.rkt +++ b/functions.rkt @@ -27,7 +27,7 @@ enumerate-boolean-functions/pv enumerate-boolean-functions/list random-boolean-table random-boolean-function random-boolean-function/list - (struct-out tbf) tbf-w tbf-θ vector-boolean->01) + (struct-out tbf) tbf-w tbf-θ boolean->01/vector) (module+ test (require typed/rackunit)) @@ -360,13 +360,13 @@ (define tbf-w tbf-weights) (define tbf-θ tbf-threshold) - (: vector-boolean->01 (-> (Vectorof Boolean) (Vectorof (U Zero One)))) - (define (vector-boolean->01 bool-v) + (: boolean->01/vector (-> (Vectorof Boolean) (Vectorof (U Zero One)))) + (define (boolean->01/vector bool-v) (vector-map (λ (x) (any->01 x)) bool-v)) (module+ test - (test-case "vector-boolean->01" - (check-equal? (vector-boolean->01 #(#t #f #f)) #(1 0 0)))) + (test-case "boolean->01/vector" + (check-equal? (boolean->01/vector #(#t #f #f)) #(1 0 0)))) (module untyped racket (module+ test @@ -454,7 +454,7 @@ enumerate-boolean-functions/pv enumerate-boolean-functions/list random-boolean-table random-boolean-function random-boolean-function/list - (struct-out tbf) tbf-w tbf-θ vector-boolean->01) + (struct-out tbf) tbf-w tbf-θ boolean->01/vector) (require (rename-in (submod 'typed untyped) [tabulate tabulate/untyped] diff --git a/scribblings/functions.scrbl b/scribblings/functions.scrbl index 49d0ea8..4460808 100644 --- a/scribblings/functions.scrbl +++ b/scribblings/functions.scrbl @@ -383,13 +383,13 @@ Shortcuts for @racket[tbf-weights] and @racket[tbf-threshold]. } -@defproc[(vector-boolean->01 [bool-v (Vectorof Boolean)]) +@defproc[(boolean->01/vector [bool-v (Vectorof Boolean)]) (Vectorof (U Zero One))]{ Converts a Boolean vector to a vector of zeros and ones. @examples[#:eval functions-evaluator -(vector-boolean->01 #(#t #f #f)) +(boolean->01/vector #(#t #f #f)) ]} @section[#:tag "fuctions/untyped"]{Untyped definitions}