update-function-form->update-function → update-function-form->update-function/any
This commit is contained in:
parent
320ae55456
commit
2c2d8fbbdb
2 changed files with 9 additions and 9 deletions
12
networks.rkt
12
networks.rkt
|
@ -16,7 +16,7 @@
|
|||
make-01-domains make-01-network update
|
||||
|
||||
UpdateFunctionForm (struct-out network-form) NetworkForm
|
||||
update-function-form->update-function
|
||||
update-function-form->update-function/any
|
||||
)
|
||||
|
||||
(define-type (State a) (VariableMapping a))
|
||||
|
@ -125,14 +125,14 @@
|
|||
#:transparent
|
||||
#:type-name NetworkForm)
|
||||
|
||||
(: update-function-form->update-function (-> UpdateFunctionForm (UpdateFunction Any)))
|
||||
(define (update-function-form->update-function form)
|
||||
(: update-function-form->update-function/any (-> UpdateFunctionForm (UpdateFunction Any)))
|
||||
(define (update-function-form->update-function/any form)
|
||||
(λ (s) (eval1-with s form)))
|
||||
|
||||
(module+ test
|
||||
(test-case "update-function-form->update-function"
|
||||
(test-case "update-function-form->update-function/any"
|
||||
(define s (hash 'x #t 'y #f))
|
||||
(define f (update-function-form->update-function '(and x y)))
|
||||
(define f (update-function-form->update-function/any '(and x y)))
|
||||
(check-equal? (f s) #f)))
|
||||
)
|
||||
|
||||
|
@ -303,7 +303,7 @@
|
|||
(define (network-form->network nf)
|
||||
(network
|
||||
(for/hash ([(x form) (in-hash (network-form-forms nf))])
|
||||
(values x (update-function-form->update-function form)))
|
||||
(values x (update-function-form->update-function/any form)))
|
||||
(network-form-domains nf)))
|
||||
|
||||
(module+ test
|
||||
|
|
|
@ -232,13 +232,13 @@ The type of instances of @racket[network-form].
|
|||
(hash 'a '(#f #t) 'b '(#f #t)))
|
||||
]}
|
||||
|
||||
@defproc[(update-function-form->update-function [func UpdateFunctionForm])
|
||||
@defproc[(update-function-form->update-function/any [func UpdateFunctionForm])
|
||||
(UpdateFunction Any)]{
|
||||
|
||||
Builds an update function from an update function form.
|
||||
|
||||
@ex[
|
||||
(define and-from-form (update-function-form->update-function '(and x y)))
|
||||
(define and-from-form (update-function-form->update-function/any '(and x y)))
|
||||
(and-from-form (hash 'x #f 'y #f))
|
||||
(and-from-form (hash 'x #f 'y #t))
|
||||
(and-from-form (hash 'x #t 'y #f))
|
||||
|
|
Loading…
Reference in a new issue