networks: apply-tbf/state → apply-tbf-to-state
The next commits will define tbf/state. The function to apply such a TBF would naturally be called apply-tbf/state, and it will be quite different from the apply-tbf-to-state, hence the renaming.
This commit is contained in:
parent
e10b208079
commit
7710e56bb8
1 changed files with 3 additions and 3 deletions
|
@ -77,7 +77,7 @@
|
||||||
[random-network (domain-mapping/c . -> . network?)]
|
[random-network (domain-mapping/c . -> . network?)]
|
||||||
[random-boolean-network ((listof variable?) . -> . network?)]
|
[random-boolean-network ((listof variable?) . -> . network?)]
|
||||||
[random-boolean-network/vars (number? . -> . network?)]
|
[random-boolean-network/vars (number? . -> . network?)]
|
||||||
[apply-tbf/state (-> tbf? state? (or/c 0 1))])
|
[apply-tbf-to-state (-> tbf? state? (or/c 0 1))])
|
||||||
;; Predicates
|
;; Predicates
|
||||||
(contract-out [variable? (-> any/c boolean?)]
|
(contract-out [variable? (-> any/c boolean?)]
|
||||||
[state? (-> any/c boolean?)]
|
[state? (-> any/c boolean?)]
|
||||||
|
@ -933,10 +933,10 @@
|
||||||
;;; The values of the variables of the state are ordered by hash-map
|
;;; The values of the variables of the state are ordered by hash-map
|
||||||
;;; and fed to the TBF in order. The number of the inputs of the TBF
|
;;; and fed to the TBF in order. The number of the inputs of the TBF
|
||||||
;;; must match the number of variables in the state.
|
;;; must match the number of variables in the state.
|
||||||
(define (apply-tbf/state tbf st)
|
(define (apply-tbf-to-state tbf st)
|
||||||
(apply-tbf tbf (list->vector (hash-map st (λ (_ val) val)))))
|
(apply-tbf tbf (list->vector (hash-map st (λ (_ val) val)))))
|
||||||
|
|
||||||
(module+ test
|
(module+ test
|
||||||
(define st (make-state '((x1 . 0) (x2 . 1))))
|
(define st (make-state '((x1 . 0) (x2 . 1))))
|
||||||
(define f (tbf #(1 1) 1))
|
(define f (tbf #(1 1) 1))
|
||||||
(check-equal? (apply-tbf/state f st) 0))
|
(check-equal? (apply-tbf-to-state f st) 0))
|
||||||
|
|
Loading…
Reference in a new issue