From 9e0db040352fb4fe6d43873aac6ac2cee522f6e5 Mon Sep 17 00:00:00 2001 From: Sergiu Ivanov Date: Sun, 23 Feb 2020 20:28:11 +0100 Subject: [PATCH] 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. --- networks-tests.rkt | 8 ++++---- networks.rkt | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/networks-tests.rkt b/networks-tests.rkt index 042ce32..d2b1f00 100644 --- a/networks-tests.rkt +++ b/networks-tests.rkt @@ -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)))] diff --git a/networks.rkt b/networks.rkt index 31bdff9..cf0a25e 100644 --- a/networks.rkt +++ b/networks.rkt @@ -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)) ;;; ============================