networks: Make nn a shortcut form network-form->network.

It used to be for make-network-from-forms, but nn is more practical in
my Org-mode setup as of now.
This commit is contained in:
Sergiu Ivanov 2020-02-23 20:28:11 +01:00
parent b0acbadadd
commit 9e0db04035
2 changed files with 6 additions and 6 deletions

View file

@ -36,8 +36,8 @@
(let ([bn1 (network-form->network (make-hash '((a . (and a b)) (b . (not b)))))]
[bn2 (make-network-from-forms '((a . (and a b))
(b . (not b))))]
[bn3 (nn '((a . (and a b))
(b . (not b))))]
[bn3 (nn #hash((a . (and a b))
(b . (not b))))]
[s (st '((a . #t) (b . #t)))])
(check-equal? ((hash-ref bn1 'a) s) #t)
(check-equal? ((hash-ref bn2 'a) s) #t)
@ -108,14 +108,14 @@
(let ([vars '(a b c)])
(check-equal? (make-asyn vars) (set (set 'a) (set 'b) (set 'c)))
(check-equal? (make-syn vars) (set (set 'a 'b 'c))))
(let* ([n (nn '((a . (not a)) (b . b)))]
(let* ([n (nn #hash((a . (not a)) (b . b)))]
[asyn (make-asyn-dynamics n)]
[syn (make-syn-dynamics n)])
(check-equal? (dynamics-network asyn) n)
(check-equal? (dynamics-mode asyn) (set (set 'a) (set 'b)))
(check-equal? (dynamics-network syn) n)
(check-equal? (dynamics-mode syn) (set (set 'a 'b))))
(let* ([n (nn '((a . (not a)) (b . b)))]
(let* ([n (nn #hash((a . (not a)) (b . b)))]
[asyn (make-asyn-dynamics n)]
[syn (make-syn-dynamics n)]
[s (st '((a . #t) (b . #f)))]

View file

@ -129,8 +129,8 @@
(define (make-network-from-forms forms)
(network-form->network (make-immutable-hash forms)))
;;; A shortcut for make-network-from-forms.
(define-syntax-rule (nn forms) (make-network-from-forms forms))
;;; A shortcut for network-form->network.
(define-syntax-rule (nn forms) (network-form->network forms))
;;; ============================