From 74a3bb9e6993e9607c055ec3666d74a46c49d193 Mon Sep 17 00:00:00 2001 From: Sergiu Ivanov Date: Mon, 12 Oct 2020 22:46:21 +0200 Subject: [PATCH] networks: Move sbf/state? to a better place. --- networks.rkt | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/networks.rkt b/networks.rkt index 0fc6f5a..eba1ef5 100644 --- a/networks.rkt +++ b/networks.rkt @@ -960,13 +960,6 @@ ;;; applied to states in an unambiguous ways. (struct tbf/state (weights threshold) #:transparent) -;;; A sign Boolean function (SBF) is a TBF whose threshold is 0. -(define sbf/state? (and/c tbf/state? (λ (tbf) (zero? (tbf/state-θ tbf))))) - -(module+ test - (test-case "sbf/state?" - (check-true (sbf/state? (tbf/state #hash((a . -1) (b . 1)) 0))))) - ;;; Shortcuts for acessing fields of a state/tbf. (define tbf/state-w tbf/state-weights) (define tbf/state-θ tbf/state-threshold) @@ -982,6 +975,13 @@ (check-equal? (tbf/state-w f) #hash((x1 . 1) (x2 . 1))) (check-equal? (tbf/state-θ f) 1))) +;;; A sign Boolean function (SBF) is a TBF whose threshold is 0. +(define sbf/state? (and/c tbf/state? (λ (tbf) (zero? (tbf/state-θ tbf))))) + +(module+ test + (test-case "sbf/state?" + (check-true (sbf/state? (tbf/state #hash((a . -1) (b . 1)) 0))))) + ;;; Applies a state TBF to its inputs. ;;; ;;; Applying a TBF consists in multiplying the weights by the