411 REFERENCE · Wikibooks
CDuce/Types/Int
Reference material by Wikibooks contributors. This retains its source identity and is not 411 news reporting.
CDuce integers are arbitrarly large, positive or negative.
The three literals 9 09 009 correspond to the same integer.
It corresponds also to the type "integer of value nine" which is a singleton set containing the integer 9.
#print_type 9;;
-> 9
The expression
type Foo = 1 | 2 | 3 | 4
define the type Foo which corresponds to the set containing the first four positive integer.
An other way to construct a set of consecutive integers:
type Foo = 1--4
#print_type -1 | -2 | -3;;
-> -3---1
The sets of strictly positive and strictly negative integers, and constructions from them
type Positive = 1--*
type Negative = *---1
type NonNul = Positive | Negative
#print_type NonNul | 0
-> Int