Type tbf-w and tbf-θ.

This commit is contained in:
Sergiu Ivanov 2022-04-21 11:50:56 +02:00
parent cc137a5459
commit e44d9c7748
2 changed files with 10 additions and 5 deletions

View File

@ -27,7 +27,7 @@
enumerate-boolean-functions/pv enumerate-boolean-functions/list
random-boolean-table random-boolean-function random-boolean-function/list
(struct-out tbf))
(struct-out tbf) tbf-w tbf-θ)
(module+ test
(require typed/rackunit))
@ -357,6 +357,8 @@
(check-true (random-bool-f/list '(#t #t)))))
(struct tbf ([weights : (Vectorof Real)] [threshold : Real]) #:transparent)
(define tbf-w tbf-weights)
(define tbf-θ tbf-threshold)
(module untyped racket
(module+ test
@ -479,10 +481,6 @@
;;; 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.
(define (vector-boolean->01 bool-v)
(vector-map any->01 bool-v))

View File

@ -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}
@defmodule[(submod dds/functions typed untyped)]