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