From 027022524b61383a7b26245b3dadd3239e78e3e9 Mon Sep 17 00:00:00 2001 From: Sergiu Ivanov Date: Thu, 21 Apr 2022 14:06:23 +0200 Subject: [PATCH] =?UTF-8?q?vector-boolean->01=20=E2=86=92=20boolean->01/ve?= =?UTF-8?q?ctor?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- functions.rkt | 12 ++++++------ scribblings/functions.scrbl | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) 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}