6.5
14 Experimental Features
These features are currently experimental and subject to change.
syntax
(declare-refinement id)
Declares id to be usable in
refinement types.
syntax
(Refinement id)
Includes values that have been tested with the
predicate id, which must have been specified with
declare-refinement.
syntax
(define-typed-struct/exec forms ...)
Defines an executable structure.
syntax
(define-new-subtype name (constructor t))
Defines a new type name that is a subtype of t.
The constructor is defined as a function that takes a value of type
t and produces a value of the new type name.
A define-new-subtype definition is only allowed at the top level of a
file or module.
This is purely a type-level distinction, with no way to distinguish the new type from the base type at runtime. Predicates made by make-predicate won’t be able distinguish them properly, so they will return true for all values that the base type’s predicate would return true for. This is usually not what you want, so you shouldn’t use make-predicate with these types.
Examples: