Chapter 26: The base library domains
26.1 Array S
26.2 BinaryPowering(T, *, E)
26.3 Boolean
26.4 Byte
26.5 Character
26.6 CommandLine
26.7 Complex R
26.8 DoubleFloat
26.9 DoubleFloatElementaryFunctions
26.10 FileName
26.11 Float
26.12 Format
26.13 FormattedOutput
26.14 Generator T
26.15 HalfInteger
26.16 HashTable(Key, Value)
26.17 InFile
26.18 Integer
26.19 IntegerMod(n)
26.20 List S
26.21 ListSort S
26.22 ModularIntegerNumberRep(I)(n)
26.23 NumberScanPackage R
26.24 Object C
26.25 OperatingSystemInterface
26.26 OutFile
26.27 Partial T
26.28 Pointer
26.29 PrimitiveArray S
26.30 Ratio I
26.31 RoundingMode
26.32 Segment S
26.33 SingleFloat
26.34 SingleInteger
26.35 SingleIntegerMod(n)
26.36 StandardIO
26.37 String
26.38 TextReader
26.39 TextWriter
26.40 Tuple T
26.1 : Array S
Description:
`Array(S)' is the domain of mono-dimensional arrays over S.
The arrays are 1-based, i.e. if `v' is an array then `v.1' is its first element.
See also `ArrayCategory'.
Parameter:
Returns:
Categories satisfied:
Aggregate(S),
ArrayCategory(S),
BasicType,
FiniteAggregate(S),
FiniteLinearAggregate(S),
LinearAggregate(S)
Cascaded exports: S
Exports:
26.2 : BinaryPowering(T, *, E)
Description:
`BinaryPowering' provides efficient exponentiation in a general setting.
For mutable data-structures, an in-place method is obtained by giving
a multiplication which updates its first argument.
Parameters:
Returns:
Exports:
26.3 : Boolean
Description:
The Boolean datatype supports logical operations.
Both arguments of the binary operations are always evaluated.
Returns:
Categories satisfied:
BasicType,
Conditional,
Finite,
Logic,
Order,
OrderedFinite
Exports:
26.4 : Byte
Description:
Byte implements single byte integers, typically 8 bits.
Returns:
Categories satisfied:
AbelianGroup,
AbelianMonoid,
ArithmeticSystem,
BasicType,
Finite,
Logic,
Monoid,
Order,
OrderedAbelianGroup,
OrderedAbelianMonoid,
OrderedFinite,
OrderedRing,
Ring
Exports:
26.5 : Character
Description:
Characters for natural language text.
In the portable byte code files, characters are represented in ASCII.
In a running program, characters are represented according to the
machine's native character set, e.g. ASCII or EBCDIC.
Returns:
Categories satisfied:
BasicType,
Finite,
Order,
OrderedFinite
Exports:
26.6 : CommandLine
Description:
`CommandLine' provides the operations to access the command line arguments
to a program.
Returns:
Exports:
26.7 : Complex R
Description:
Complex(R) implements complex numbers over a field, `R'.
Domains created by the constructor are fields and implement additional
operations to manipulate the real and imaginary parts of complex numbers.
Parameter:
Returns:
Categories satisfied:
AbelianGroup,
AbelianMonoid,
ArithmeticSystem,
BasicType,
EuclideanDomain,
Field,
Group,
Monoid,
Ring
Cascaded exports: R
Exports:
26.8 : DoubleFloat
Description:
`DoubleFloat' implements double-precision floating point numbers.
In the portable byte code files, double precision floats are represented in
a format capable of representing IEEE extended double precision.
In a running program, double precision floats are represented according
to the machine's native arithmetic.
Returns:
Categories satisfied:
AbelianGroup,
AbelianMonoid,
ArithmeticSystem,
BasicType,
EuclideanDomain,
Field,
Finite,
FloatingPointNumberSystem,
Group,
Monoid,
Order,
OrderedAbelianGroup,
OrderedAbelianMonoid,
OrderedFinite,
OrderedRing,
Ring
Cascaded exports: RoundingMode
Exports:
26.9 : DoubleFloatElementaryFunctions
Description:
`DoubleFloatElementaryFunctions' provides elementary functions for
`DoubleFloat'.
Returns:
Exports:
26.10 : FileName
Description:
`FileName' provides a set of operations for portable file name
manipulation. Generally used with the operations exported by `InFile'
and `OutFile'.
Returns:
Exports:
filename("/usr/include", "stdio", "h")refers to the file ``/usr/include/stdio.h''.
26.11 : Float
Description:
`Float' implements arbitrary precision floating
point arithmetic.
The number of significant digits of each operation can be set
to an arbitrary value (the default is 20 decimal digits).
The operation `float(significand, exponent, base)'
for integer `significand', `exponent' specifies the number
`significand * base (exponent)'.
The underlying representation for floats is binary
not decimal. The implications of this are described below.
The model adopted is that arithmetic operations are rounded to the
nearest unit in the last place, that is, accurate to within
`2(-bits)'.
Also, the elementary functions and constants are
accurate to one unit in the last place. A float is represented as a
record of two integers, the significand and the exponent. The base
of the representation is binary, hence a
`Record(m: significand, e: exponent)'
represents the number `m * 2e'. Though it is not
assumed that the underlying integers are represented with a binary
base, the code will be most efficient when this is the the case. The
decision to choose the base to be binary has some unfortunate
consequences. First, decimal numbers like 0.3 cannot be represented
exactly. Second, there is a further loss of accuracy during
conversion to decimal for output. To compensate for this, if d digits
of precision are specified, `1 + ceiling(log2 d)' bits are used.
Two numbers that are displayed identically may therefore not in fact be equal.
On the other hand, a significant efficiency loss would be incurred if
we chose to use a decimal base when the underlying integer base is
binary.
Returns:
Categories satisfied:
AbelianGroup,
AbelianMonoid,
ArithmeticSystem,
BasicType,
EuclideanDomain,
Field,
Group,
Monoid,
Order,
OrderedAbelianGroup,
OrderedAbelianMonoid,
OrderedRing,
Ring
Cascaded exports: RoundingMode
Exports:
26.12 : Format
Description:
`Format' provides the basic operation for conversion of numbers to and from
strings.
Returns:
Exports:
26.13 : FormattedOutput
Description:
`FormattedOutput' provides functions which format their arguments
according to a control string. The control characters are:
Returns:
Exports:
26.14 : Generator T
Description:
`Generator(T)' is a type which allows `T' values to be obtained serially
in a `repeat' or `collect' form. This is an "extend" of the
language-defined Generator.
Parameter:
Returns:
Cascaded exports: T
Exports:
26.15 : HalfInteger
Description:
`HalfInteger' implements half-precision integers, typically 16 bits.
Returns:
Categories satisfied:
AbelianGroup,
AbelianMonoid,
ArithmeticSystem,
BasicType,
Finite,
Logic,
Monoid,
Order,
OrderedAbelianGroup,
OrderedAbelianMonoid,
OrderedFinite,
OrderedRing,
Ring
Exports:
26.16 : HashTable(Key, Value)
Description:
`HashTable(Key, Val)' provides a parameterized hash-table datatype.
Parameters:
Returns:
Categories satisfied:
BasicType
Cascaded exports: Key, Value
Exports:
26.17 : InFile
Description:
`InFile' is the domain of input text files.
Returns:
Exports:
26.18 : Integer
Description:
`Integer' provides operations for arbitrary precision (big) integer arithmetic.
Returns:
Categories satisfied:
AbelianGroup,
AbelianMonoid,
ArithmeticSystem,
BasicType,
EuclideanDomain,
IntegerNumberSystem,
Monoid,
Order,
OrderedAbelianGroup,
OrderedAbelianMonoid,
OrderedRing,
Ring,
Steppable
Cascaded exports: Segment Integer
Exports:
26.19 : IntegerMod(n)
Parameter:
Returns:
Categories satisfied:
AbelianGroup,
AbelianMonoid,
ArithmeticSystem,
BasicType,
Monoid,
Ring
ModularIntegerNumberSystem
Exports:
26.20 : List S
Description:
`List(S)' is the domain of linked lists.
Parameter:
Returns:
Categories satisfied:
Aggregate(S),
BasicType,
Conditional,
FiniteAggregate(S),
FiniteLinearAggregate(S),
LinearAggregate(S),
ListCategory(S)
Cascaded exports: 'first', 'rest'
Exports:
26.21 : ListSort S
Description:
`ListSort(S)' provides functions to sort linked lists.
Parameter:
Returns:
Exports:
26.22 : ModularIntegerNumberRep(I)(n)
Description:
`ModularIntegerNumberRep(I)(n)' provides operations for modular integer
arithmetic.
Parameters:
Returns:
Exports:
26.23 : NumberScanPackage R
Parameter:
Returns:
Exports:
26.24 : Object C
Parameter:
Returns:
Exports:
26.25 : OperatingSystemInterface
Description:
`OperatingSystemInterface' provides a platform-independent method for
accessing some operating system services, for example file and
directory manipulation. This is a very low-level interface ---
the functions avoid allocating storage and consequently are more
complicated to use.
Returns:
Exports:
run("foo", fin, fout, nil pretend Record(val:Pointer));Then anything written to fin becomes available to foo on its stdin and anything which foo writes to stdout can be read from fout. The last argument, nil, causes foo's stderr to remain uncaptured. A return code of 0 indicates success spawning. Failure gives -1. To determine whether the platform supports concurrent processes, call "run" with the command string `nil pretend String' or call the function "canRunConcurrent?".
26.26 : OutFile
Description:
`OutFile' is the domain of output text files.
Returns:
Exports:
26.27 : Partial T
Description:
`Partial' is a type which allows values of soft failures to be returned.
Parameter:
Returns:
Exports:
26.28 : Pointer
Description:
`Pointer' provides basic operations for pointer addressing.
Returns:
Categories satisfied:
BasicType,
Conditional
Exports:
26.29 : PrimitiveArray S
Description:
`PrimitiveArray(S)' is the domain of mono-dimensional arrays. Unlike the
`Array(S)' domain, primitive-arrays contain no size information.
Note that the indexing is 1-based (see `Array').
Parameter:
Returns:
Cascaded exports: S
Exports:
26.30 : Ratio I
Description:
`Ratio(I)' defines arithmetic on fractions over an IntegerNumberSystem.
Parameter:
Returns:
Categories satisfied:
AbelianGroup,
AbelianMonoid,
ArithmeticSystem,
BasicType,
EuclideanDomain,
Field,
Group,
Monoid,
Order,
OrderedAbelianGroup,
OrderedAbelianMonoid,
OrderedRing,
Ring
Cascaded exports: I
Exports:
26.31 : RoundingMode
Description:
Modes for rounding.
Returns:
Exports:
26.32 : Segment S
Description:
`Segment(S)' provides ranges for indexing or iteration.
Parameter:
Returns:
Exports:
26.33 : SingleFloat
Description:
`SingleFloat' implements single-precision floating point numbers.
In the portable byte code files, single-precision floats are represented in
a format capable of representing IEEE extended single-precision.
In a running program, single-precision floats are represented according
to the machine's native arithmetic.
Returns:
Categories satisfied:
AbelianGroup,
AbelianMonoid,
ArithmeticSystem,
BasicType,
EuclideanDomain,
Field,
Finite,
FloatingPointNumberSystem,
Group,
Monoid,
Order,
OrderedAbelianGroup,
OrderedAbelianMonoid,
OrderedFinite,
OrderedRing,
Ring
Cascaded exports: RoundingMode
Exports:
26.34 : SingleInteger
Description:
`SingleInteger' implements single-precision integers, typically 32 bits.
Returns:
Categories satisfied:
AbelianGroup,
AbelianMonoid,
ArithmeticSystem,
BasicType,
EuclideanDomain,
IntegerNumberSystem,
Monoid,
Order,
OrderedAbelianGroup,
OrderedAbelianMonoid,
OrderedRing,
Ring,
Steppable
Cascaded exports: Segment SingleInteger
Exports:
26.35 : SingleIntegerMod(n)
Parameter:
Returns:
Categories satisfied:
AbelianGroup,
AbelianMonoid,
ArithmeticSystem,
BasicType,
Monoid,
Ring
Exports:
26.36 : StandardIO
Returns:
Exports:
26.37 : String
Description:
`String' is the type of character strings for natural language text.
Returns:
Categories satisfied:
BasicType
Exports:
26.38 : TextReader
Description:
`TextReader' provides operations for generic text input sources.
Returns:
Exports:
26.39 : TextWriter
Description:
`TextWriter' is the domain of writable text streams.
Returns:
Exports:
26.40 : Tuple T
Description:
`Tuple(T)' provides functions for values of type `Tuple T'.
This is an "extend" of the language-defined Tuple.
Parameter:
Returns:
Cascaded exports: T
Exports: