Next Previous Up Top Contents Index

5.5 The Big-Integers library

5.5.1 Specific constructors

The Big-Integers library extends the functionality of specific constructors in the Dylan library as follows:

limited

G.f. method

limited abstract-integer-class #key min max => limited-type

Returns a limited integer type, which is a subtype of <abstract-integer>, whose instances are integers greater than or equal to min (if specified) and less than or equal to max (if specified). If no keyword arguments are specified, the result type is equivalent to <abstract-integer>. The argument abstract-integer-class is the class <abstract-integer>.
If both min and max are supplied, and both are instances of <integer>, then the result type is equivalent to calling limited on <integer> with those same bounds.

The Limited Integer Type Protocol is extended to account for limited <abstract-integer> types.

Table 5.1 Instances and subtypes in the Big-Integers library

This is true if and only if ...

... all these clauses are true

instance?
  (x, 
   limited(<abstract-integer>,
   min: y, max: z))
instance?(x, <abstract-integer>) (y <= x) (x <= z)
instance? (x, limited(<abstract-integer>, min: y)) instance?(x, <abstract-integer>) (y <= x)
instance? (x, limited(<abstract-integer>, max: z)) instance?(x, <abstract-integer>) (x <= z)
subtype? (limited(<abstract-integer>, min: w, max: x), limited(<abstract-integer>, min: y, max: z)) (w >= y) (x <= z)
subtype? (limited(<abstract-integer>, min: w ...), limited(<abstract-integer>, min: y)) (w >= y)
subtype? (limited(<abstract-integer>, max: x ...), limited(<abstract-integer>, max: z)) (x <= z)

Table 5.2 Type-equivalence in the Big-Integers library

This is type equivalent to ...

... this, if and only if ...

... this is true

limited
  (<abstract-integer>,
   min: y, max: z)
limited (<integer>, min: y, max: z)

y and z are both instances of <integer>.

limited
  (<abstract-integer>,
   min: y, 
   max: $maximum-integer)
limited (<integer>, min: y)

y is an instance of <integer>.

limited
  (<abstract-integer>,
   min: $minimum-integer,
   max: z)
limited (<integer>, max: z)

z is an instance of <integer>.

Type disjointness is modified as follows to account for limited <abstract-integer> types.

A limited integer type is disjoint from a class if their base types are disjoint or the class is <integer> and the range of the limited integer type is disjoint from the range of <integer> (that is, from $minimum-integer to $maximum-integer).

Common Dylan and Functional Extensions - 31 Mar 00

Next Previous Up Top Contents Index