From 251a7dcf23014c865522dd47a096a9b4646998e4 Mon Sep 17 00:00:00 2001 From: Sergiu Ivanov Date: Sun, 23 Feb 2020 00:15:18 +0100 Subject: [PATCH] networks: make-same-domain-mapping -> make-same-domains, make-boolean-domain-mapping -> make-boolean-domains --- networks-tests.rkt | 2 +- networks.rkt | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/networks-tests.rkt b/networks-tests.rkt index a1d4d9b..10aeb4d 100644 --- a/networks-tests.rkt +++ b/networks-tests.rkt @@ -72,7 +72,7 @@ ((a . #t) (b . #f)) ((a . #f) (b . #t)) ((a . #f) (b . #f)))) - (check-equal? (hash->list (make-boolean-domain-mapping '(a b))) + (check-equal? (hash->list (make-boolean-domains '(a b))) '((a . (#f #t)) (b . (#f #t)))) (let ([n #hash((a . (not b)) (b . a))] diff --git a/networks.rkt b/networks.rkt index 79b2c6c..49726e5 100644 --- a/networks.rkt +++ b/networks.rkt @@ -25,8 +25,8 @@ [build-interaction-graph (-> network-form? graph?)] [build-all-states (-> (listof (cons/c variable? generic-set?)) (listof state?))] [build-all-states-same-domain (-> (listof variable?) generic-set? (listof state?))] - [make-same-domain-mapping (-> (listof variable?) generic-set? (hash/c variable? generic-set?))] - [make-boolean-domain-mapping (-> (listof variable?) (hash/c variable? (list/c #f #t)))] + [make-same-domains (-> (listof variable?) generic-set? (hash/c variable? generic-set?))] + [make-boolean-domains (-> (listof variable?) (hash/c variable? (list/c #f #t)))] [get-interaction-sign (-> network-form? (hash/c variable? generic-set?) variable? variable? (or/c '+ '- '0))]) ;; Predicates (contract-out [variable? (-> any/c boolean?)] @@ -162,12 +162,12 @@ (build-all-states (for/list ([v vars]) (cons v domain)))) ;;; Makes a hash set mapping all variables to a single domain. -(define (make-same-domain-mapping vars domain) +(define (make-same-domains vars domain) (make-immutable-hash (for/list ([var vars]) (cons var domain)))) ;;; Makes a hash set mapping all variables to the Boolean domain. -(define (make-boolean-domain-mapping vars) - (make-same-domain-mapping vars '(#f #t))) +(define (make-boolean-domains vars) + (make-same-domains vars '(#f #t))) ;;; Given two interacting variables of a network form and the domains ;;; of the variables, returns '+ if the interaction is monotonously