functions: Add list->sbf.
This commit is contained in:
parent
ac0f90ce23
commit
bf45cf6382
1 changed files with 9 additions and 1 deletions
|
@ -40,7 +40,8 @@
|
|||
[tbf-tabulate* (-> (listof tbf?) (listof (listof (or/c 0 1))))]
|
||||
[tbf-tabulate (-> tbf? (listof (listof (or/c 0 1))))]
|
||||
[tbf-tabulate*/boolean (-> (listof tbf?) (listof (listof boolean?)))]
|
||||
[sbf (-> (vectorof number?) tbf?)])
|
||||
[sbf (-> (vectorof number?) tbf?)]
|
||||
[list->sbf (-> (listof number?) sbf?)])
|
||||
;; Predicates
|
||||
(contract-out
|
||||
[sbf? (-> any/c boolean?)]))
|
||||
|
@ -383,3 +384,10 @@
|
|||
|
||||
(module+ test
|
||||
(check-equal? (sbf #(1 -1)) (tbf '#(1 -1) 0)))
|
||||
|
||||
;;; Converts a list of numbers to an SBF. The elements of the list
|
||||
;;; are taken to be the weights of the SBF.
|
||||
(define list->sbf (compose sbf list->vector))
|
||||
|
||||
(module+ test
|
||||
(check-equal? (list->sbf '(1 -1)) (tbf '#(1 -1) 0)))
|
||||
|
|
Loading…
Reference in a new issue