From 36c26d2a1f99147481fb0a3583c3f60915aeae5d Mon Sep 17 00:00:00 2001 From: Sergiu Ivanov Date: Fri, 20 Mar 2020 16:38:32 +0100 Subject: [PATCH] networks: Export and test boolean-power-n. --- networks-tests.rkt | 1 + networks.rkt | 1 + 2 files changed, 2 insertions(+) diff --git a/networks-tests.rkt b/networks-tests.rkt index bec5fbe..4c1c285 100644 --- a/networks-tests.rkt +++ b/networks-tests.rkt @@ -215,6 +215,7 @@ '((#f #f #f) (#f #t #f) (#t #f #f) (#t #t #t))) (check-equal? (tabulate/boolean (lambda (x y) (and x y))) '((#f #f #f) (#f #t #f) (#t #f #f) (#t #t #t))) + (check-equal? (boolean-power-n 2) '((#f #f) (#f #t) (#t #f) (#t #t))) (let ([negation (table->function '((#t #f) (#f #t)))] [negation/list (table->function/list '((#t #f) (#f #t)))]) (check-true (negation #f)) (check-false (negation #t)) diff --git a/networks.rkt b/networks.rkt index faea2d3..2977ddd 100644 --- a/networks.rkt +++ b/networks.rkt @@ -61,6 +61,7 @@ [tabulate/boolean (-> procedure-fixed-arity? (listof (listof boolean?)))] [table->function (-> (listof (*list/c any/c any/c)) procedure?)] [table->function/list (-> (listof (*list/c any/c any/c)) procedure?)] + [boolean-power-n (-> number? (listof (listof boolean?)))] [enumerate-boolean-tables (-> number? (stream/c (listof (*list/c any/c any/c))))] [enumerate-boolean-functions (-> number? (stream/c procedure?))] [enumerate-boolean-functions/list (-> number? (stream/c procedure?))])