Add and use deftype and defpolytype.

This commit is contained in:
Sergiu Ivanov 2022-04-29 16:32:22 +02:00
parent e867a86d4d
commit bed1ed24f3
3 changed files with 23 additions and 8 deletions

View File

@ -13,6 +13,9 @@
@(define-syntax-rule (ex . args)
(examples #:eval functions-evaluator . args))
@(define-syntax-rule (deftype . args)
(defidform #:kind "type" . args))
@title[#:tag "functions"]{dds/functions: Formal Functions}
@defmodule[dds/functions]
@ -457,7 +460,7 @@ Instances of @racket[tbf] have the type @racket[TBF].
}
@defidform[#:kind "type" TBF]{
@deftype[TBF]{
The type of the instances of @racket[tbf]:

View File

@ -16,6 +16,12 @@
@(define-syntax-rule (ex . args)
(examples #:eval networks-evaluator . args))
@(define-syntax-rule (defpolytype . args)
(defform #:kind "polymorphic type" . args))
@(define-syntax-rule (deftype . args)
(defidform #:kind "type" . args))
@title[#:tag "networks"]{dds/networks: Formal Dynamical Networks}
@defmodule[(submod dds/networks typed)]
@ -27,21 +33,21 @@ This model can generalise Boolean networks, TBANs, multivalued networks, etc.
@section[#:tag "networks-basics"]{Basic types}
@defform[#:kind "type" (State a)]{
@defpolytype[(State a)]{
An immutable mapping (a hash table) assigning elements of type @racket[a] to
the variables. A synonym of @racket[VariableMapping].
}
@defform[#:kind "type" (UpdateFunction a)]{
@defpolytype[(UpdateFunction a)]{
An update function is a function computing a value from the given
state. This is a synonym of the type @racket[(-> (State a) a)].
}
@defform[#:kind "type" (Domain a)]{
@defpolytype[(Domain a)]{
A domain which is a subset of the type @racket[a].
@ -49,7 +55,7 @@ A domain which is a subset of the type @racket[a].
}
@defform[#:kind "type" (DomainMapping a)]{
@defpolytype[(DomainMapping a)]{
A domain mapping is a hash table mapping variables to the lists of values in
their domains.
@ -66,7 +72,7 @@ Instances of @racket[network] have the type @racket[Network].
}
@defidform[#:kind "type" Network]{
@deftype[Network]{
The type of the instances of @racket[Network].

View File

@ -15,6 +15,12 @@
@(define-syntax-rule (ex . args)
(examples #:eval utils-evaluator . args))
@(define-syntax-rule (defpolytype . args)
(defform #:kind "type" . args))
@(define-syntax-rule (deftype . args)
(defidform #:kind "polymorphic type" . args))
@title[#:tag "utils"]{dds/utils: Various Utilities}
@defmodule[dds/utils]
@ -25,13 +31,13 @@ the package: evaluating sexps, manipulating lists,
@section{Base types}
@defidform[#:kind "type" Variable]{
@deftype[Variable]{
Any Racket symbol. Designates a variable in a discrete dynamical network.
}
@defform[#:kind "type" (VariableMapping A)]{
@defpolytype[(VariableMapping A)]{
An immutable mapping (a hash table) assigning elements of type @racket[A] to
the variables.