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:
Sergiu Ivanov 2020-07-22 23:53:20 +02:00
parent e10b208079
commit 7710e56bb8

View File

@ -77,7 +77,7 @@
[random-network (domain-mapping/c . -> . network?)]
[random-boolean-network ((listof variable?) . -> . 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
(contract-out [variable? (-> any/c boolean?)]
[state? (-> any/c boolean?)]
@ -933,10 +933,10 @@
;;; 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
;;; 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)))))
(module+ test
(define st (make-state '((x1 . 0) (x2 . 1))))
(define f (tbf #(1 1) 1))
(check-equal? (apply-tbf/state f st) 0))
(check-equal? (apply-tbf-to-state f st) 0))