8.16.0.2
2 Data Types
(require rebellion/type) | package: rebellion |
A data type or simply type is a set of values together with 1) some basic operations on those values and 2) a predicate to test whether a value is within that set. There are many different kinds of data types, with different basic operations and meant for different use cases.
> (define-tuple-type point (x y)) > (point 7 42) (point 7 42)
> (define-record-type circle (radius color)) > (circle #:radius 5 #:color 'red) (circle #:color 'red #:radius 5)
> (define-wrapper-type inches) > (inches 17) (inches 17)
> (define-singleton-type undefined) > undefined #<undefined>