From c55113f27ef2d58213291627aba316e17f3fee26 Mon Sep 17 00:00:00 2001 From: Sergiu Ivanov Date: Wed, 18 Nov 2020 00:46:55 +0100 Subject: [PATCH] network: Bug fix in get-interaction-sign. --- networks.rkt | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/networks.rkt b/networks.rkt index 3328a74..931bef3 100644 --- a/networks.rkt +++ b/networks.rkt @@ -473,11 +473,11 @@ [(and (member '> impacts) (not (member '< impacts))) '>] [(equal? impacts '(=)) '=] [else 0])))) - (match interactions - [(list '<) 1] - [(list '>) -1] - [(list '=) #f] - [_ 0])) + (cond + [(and (member '< interactions) (not (member '> interactions))) 1] + [(and (member '> interactions) (not (member '< interactions))) -1] + [(equal? interactions '(=)) #f] + [else 0])) (module+ test (test-case "get-interaction-sign" @@ -491,6 +491,7 @@ (check-equal? (get-interaction-sign n-bool bool-doms 'x 'y) 1) (check-equal? (get-interaction-sign n-bool bool-doms 'y 'x) -1) (check-false (get-interaction-sign n-bool bool-doms 'x 'z)) + (check-equal? (get-interaction-sign n-bool bool-doms 'y 'z) 1) (check-equal? (get-interaction-sign n-bool bool-doms 'x 't) 0) (define n-multi (network-form->network (hash 'x '(min (+ y 1) 2)