Type tbf.
This commit is contained in:
parent
212440add1
commit
cc137a5459
2 changed files with 15 additions and 9 deletions
|
@ -25,7 +25,9 @@
|
|||
table->function/list table->function table->function/pv
|
||||
enumerate-boolean-tables enumerate-boolean-functions
|
||||
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))
|
||||
|
||||
(module+ test
|
||||
(require typed/rackunit))
|
||||
|
@ -354,6 +356,8 @@
|
|||
(check-false (random-bool-f/list '(#t #f)))
|
||||
(check-true (random-bool-f/list '(#t #t)))))
|
||||
|
||||
(struct tbf ([weights : (Vectorof Real)] [threshold : Real]) #:transparent)
|
||||
|
||||
(module untyped racket
|
||||
(module+ test
|
||||
(require rackunit))
|
||||
|
@ -438,16 +442,15 @@
|
|||
table->function/list table->function table->function/pv
|
||||
enumerate-boolean-tables enumerate-boolean-functions
|
||||
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))
|
||||
|
||||
(require (rename-in (submod 'typed untyped)
|
||||
[tabulate tabulate/untyped]
|
||||
[tabulate* tabulate*/untyped]))
|
||||
|
||||
(provide
|
||||
;; Structures
|
||||
(contract-out
|
||||
[struct tbf ((weights (vectorof number?)) (threshold number?))])
|
||||
;; Functions
|
||||
(contract-out
|
||||
[tbf-w (-> tbf? (vectorof number?))]
|
||||
|
@ -476,10 +479,6 @@
|
|||
;;; Threshold Boolean functions
|
||||
;;; ===========================
|
||||
|
||||
;;; A threshold Boolean function (TBF) is a pair (w, θ), where w is a
|
||||
;;; vector of weights and θ is the threshold.
|
||||
(struct tbf (weights threshold) #:transparent)
|
||||
|
||||
;;; Unicode shortcuts for accessing the elements of a TBF.
|
||||
(define tbf-w tbf-weights)
|
||||
(define tbf-θ tbf-threshold)
|
||||
|
|
|
@ -369,6 +369,13 @@ a list of arguments.
|
|||
|
||||
@section{Threshold Boolean functions}
|
||||
|
||||
@defstruct*[tbf ([weights (Vectorof Real)] [threshold Real])]{
|
||||
|
||||
A threshold Boolean function (TBF) is a pair @tt{(w, θ)}, where @tt{w} is
|
||||
a vector of weights and @tt{θ} is the threshold.
|
||||
|
||||
}
|
||||
|
||||
@section[#:tag "fuctions/untyped"]{Untyped definitions}
|
||||
|
||||
@defmodule[(submod dds/functions typed untyped)]
|
||||
|
|
Loading…
Reference in a new issue