networks: list-interactions → list-syntactic-interactions.

This commit is contained in:
Sergiu Ivanov 2020-11-12 01:09:18 +01:00
parent 681ed0e732
commit 5ece1f6c88

View file

@ -29,7 +29,7 @@
[network-form->network (-> network-form? network?)] [network-form->network (-> network-form? network?)]
[make-network-from-forms (-> (listof (cons/c symbol? update-function-form?)) [make-network-from-forms (-> (listof (cons/c symbol? update-function-form?))
network?)] network?)]
[list-interactions (-> network-form? variable? (listof variable?))] [list-syntactic-interactions (-> network-form? variable? (listof variable?))]
[build-syntactic-interaction-graph (-> network-form? graph?)] [build-syntactic-interaction-graph (-> network-form? graph?)]
[build-all-states (-> domain-mapping/c (listof state?))] [build-all-states (-> domain-mapping/c (listof state?))]
[make-same-domains (-> (listof variable?) generic-set? domain-mapping/c)] [make-same-domains (-> (listof variable?) generic-set? domain-mapping/c)]
@ -294,17 +294,17 @@
;;; Lists the variables of the network form appearing in the update ;;; Lists the variables of the network form appearing in the update
;;; function form for x. ;;; function form for x.
(define (list-interactions nf x) (define (list-syntactic-interactions nf x)
(set-intersect (set-intersect
(extract-symbols (hash-ref nf x)) (extract-symbols (hash-ref nf x))
(hash-keys nf))) (hash-keys nf)))
(module+ test (module+ test
(test-case "list-interactions" (test-case "list-syntactic-interactions"
(define n #hash((a . (+ a b c)) (define n #hash((a . (+ a b c))
(b . (- b c)))) (b . (- b c))))
(check-true (set=? (list-interactions n 'a) '(a b))) (check-true (set=? (list-syntactic-interactions n 'a) '(a b)))
(check-true (set=? (list-interactions n 'b) '(b))))) (check-true (set=? (list-syntactic-interactions n 'b) '(b)))))
;;; Builds the graph in which the vertices are the variables of a ;;; Builds the graph in which the vertices are the variables of a
;;; given network, and which contains an arrow from a to b whenever a ;;; given network, and which contains an arrow from a to b whenever a
@ -322,7 +322,7 @@
(define (build-syntactic-interaction-graph n) (define (build-syntactic-interaction-graph n)
(transpose (transpose
(unweighted-graph/adj (unweighted-graph/adj
(for/list ([(var _) n]) (cons var (list-interactions n var)))))) (for/list ([(var _) n]) (cons var (list-syntactic-interactions n var))))))
(module+ test (module+ test
(test-case "build-syntactic-interaction-graph" (test-case "build-syntactic-interaction-graph"