diff --git a/networks.rkt b/networks.rkt index 0be4950..0dda5cb 100644 --- a/networks.rkt +++ b/networks.rkt @@ -216,6 +216,10 @@ [(cons var 0) (cons var #f)] [(cons var 1) (cons var #t)])))) +;;; Booleanizes a given state: replaces 0 with #f and 1 with #t. +(define (booleanize-state s) + (for/hash ([(x val) s]) (match val [0 (values x #f)] [1 (values x #t)]))) + (module+ test (test-case "make-state, make-state-booleanize, booleanize-state" (check-equal? (make-state-booleanize '((a . 0) (b . 1))) @@ -223,10 +227,6 @@ (check-equal? (booleanize-state (make-state '((a . 0) (b . 1)))) (make-state '((a . #f) (b . #t)))))) -;;; Booleanizes a given state: replaces 0 with #f and 1 with #t. -(define (booleanize-state s) - (for/hash ([(x val) s]) (match val [0 (values x #f)] [1 (values x #t)]))) - ;;; ================================= ;;; Syntactic description of networks