Type tbf-w and tbf-θ.
This commit is contained in:
parent
cc137a5459
commit
e44d9c7748
2 changed files with 10 additions and 5 deletions
|
@ -27,7 +27,7 @@
|
||||||
enumerate-boolean-functions/pv enumerate-boolean-functions/list
|
enumerate-boolean-functions/pv enumerate-boolean-functions/list
|
||||||
random-boolean-table random-boolean-function random-boolean-function/list
|
random-boolean-table random-boolean-function random-boolean-function/list
|
||||||
|
|
||||||
(struct-out tbf))
|
(struct-out tbf) tbf-w tbf-θ)
|
||||||
|
|
||||||
(module+ test
|
(module+ test
|
||||||
(require typed/rackunit))
|
(require typed/rackunit))
|
||||||
|
@ -357,6 +357,8 @@
|
||||||
(check-true (random-bool-f/list '(#t #t)))))
|
(check-true (random-bool-f/list '(#t #t)))))
|
||||||
|
|
||||||
(struct tbf ([weights : (Vectorof Real)] [threshold : Real]) #:transparent)
|
(struct tbf ([weights : (Vectorof Real)] [threshold : Real]) #:transparent)
|
||||||
|
(define tbf-w tbf-weights)
|
||||||
|
(define tbf-θ tbf-threshold)
|
||||||
|
|
||||||
(module untyped racket
|
(module untyped racket
|
||||||
(module+ test
|
(module+ test
|
||||||
|
@ -479,10 +481,6 @@
|
||||||
;;; Threshold Boolean functions
|
;;; Threshold Boolean functions
|
||||||
;;; ===========================
|
;;; ===========================
|
||||||
|
|
||||||
;;; Unicode shortcuts for accessing the elements of a TBF.
|
|
||||||
(define tbf-w tbf-weights)
|
|
||||||
(define tbf-θ tbf-threshold)
|
|
||||||
|
|
||||||
;;; Converts a Boolean vector to a 0-1 vector.
|
;;; Converts a Boolean vector to a 0-1 vector.
|
||||||
(define (vector-boolean->01 bool-v)
|
(define (vector-boolean->01 bool-v)
|
||||||
(vector-map any->01 bool-v))
|
(vector-map any->01 bool-v))
|
||||||
|
|
|
@ -376,6 +376,13 @@ a vector of weights and @tt{θ} is the threshold.
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@deftogether[(@defproc[(tbf-w [t tbf]) (Vectorof Real)]
|
||||||
|
@defproc[(tbf-θ [t tbf]) Real])]{
|
||||||
|
|
||||||
|
Shortcuts for @racket[tbf-weights] and @racket[tbf-threshold].
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@section[#:tag "fuctions/untyped"]{Untyped definitions}
|
@section[#:tag "fuctions/untyped"]{Untyped definitions}
|
||||||
|
|
||||||
@defmodule[(submod dds/functions typed untyped)]
|
@defmodule[(submod dds/functions typed untyped)]
|
||||||
|
|
Loading…
Reference in a new issue