Chapter 25: The base library categories
25.15 FloatingPointNumberSystem
A number of types are provided by a ``Base Aldor Library'',
supplied with the compiler for Aldor.
Their definitions can be made accessible to a program by
the system command #include "aldor"
.
This chapter describes the categories defined in the base library, and the next chapter describes the domains. We have made a number of choices to try to make certain specific information readily accessible while minimizing redundancy. The full set of exports is listed both for categories and domains. This makes it easy to see at a glance what operations a type provides. The detailed descriptions of the operations, however, are not repeated in each type to which they are inherited. For that information, it is necessary to follow the reference to the place where the export is originally defined.
As an example, consider the category FiniteLinearAggregate S
,
in which the empty?
operation has the entry:
empty?% -> Boolean[default] from Aggregate(S)
The notation ``from Aggregate(S)'' means that empty?
has its original declaration in that inherited category.
To see a description of what empty?
does,
you should turn to the section for Aggregate S
.
The notation ``[default]'' means that empty?
has a default definition.
This may be supplied either by the category itself
or by one of the categories from which it inherits.
In this case, the default definition is inherited from
FiniteAggregate S
.
The default information is given for categories only, since it is a private matter whether a domain supplies an export directly, or via its category's defaults.
Some values supplied by the base library have publicly visible definitions, that is, they are given values with define ... == .... When this is the case, the entire definition is shown in the corresponding section.
25.1 : AbelianGroup
DescriptionsExports:
Identity for addition. | |
Identity function | [default] |
Addition | |
Test whether value equals 0. |
[default] |
Negation. | |
Subtraction. |
[default] |
from BasitType | |
[default] from BasicType | |
from BasicType | |
[default] from BasicType | |
[default] from BasicType | |
[default] from BasicType |
define AbelianGroup: Category == AbelianMonoid with { -: % -> %; -: (%, %) -> %; default (a: %) - (b: %): % == a + (-b); }
25.2 : AbelianMonoid
Description:Identity for addition | |
Identity function. | [default] |
Addition. | |
Test whether value equals 0. |
[default] |
from BasicType | |
[default]from BasicType | |
from BasicType | |
[default]BasitType | |
[default]from BasicType | |
[default from BasicType |
define AbelianMoniod: Category == BasicType { 0: %; +: % -> %; +: (%, %) -> %; zero?: % -> Boolean; default +(x: %): % == x; default zero? (x:%) : Boolean == x == 0; default sample: % == 0; }
25.3 : Aggregate S
Description:Parameter:
Directly inherits:
BasicType
Exports:
Is the element count zero? |
|
Generic traversal of an aggregate. |
|
Form new aggregate using function. |
|
from BasicType | |
[default] from BasicType | |
from BasicType | |
[default] from BasicType | |
from BasicType | |
[default] from BasicType |
define Aggregate(S: Type): Category == BasicType with { empty?: % -> Boolean; generator:% -> Generator S; map: (S->S, %) -> %; export from S; }
25.4 : ArithmeticSystem
Description:Directly inherits:
(none)
Exports::
Indentiyt for `+'. | |
Identity function. | |
Addition. | |
Negation. | |
Identity for `*' | |
Multiplication | |
define ArithmeticSystem: Category == with { 0: %; +: % -> %; +: (%, %) -> %; -: % -> %; -: (%, %) -> %; 1: %; *: (%, %) -> %; ^: (%, Integer) -> %; }
25.5 : ArrayCategory S
Parameter:
Directly inherits:
FiniteLinearAggregate(S)
Exports:
`set!(a,n,s)' sets the nth element of `a' to `s'. |
|
`dispose!(a)' indicates that `a' will no longer be used. |
Definition:
define ArrayCategory(S: Type): Category == FiniteLinearAggregate S with { set!: (%, SingleInteger, S) -> S; dispose!: % -> (); }
25.6 : BasicType
Directly inherits:
(none)
Exports:
Equality and inequality test. |
[default] |
Basic output. |
[default] |
Example element. |
|
Hashing function. |
[default] |
Definition:
define BasicType: Category == with { =: (%, %) -> Boolean; ~=: (%, %) -> Boolean; <<: (TextWriter, %) -> TextWriter; <<: % -> TextWriter -> TextWriter; sample: %; hash: % -> SingleInteger; default (x: %) ~= (y: %): Boolean == not (x = y); default hash(x: %): SingleInteger == (0$Machine)::SingleInteger; default (<<)(x: %)(p: TextWriter): TextWriter == p << x; }
25.7 : Conditional
Description:
`Conditional' allows values to be used in conditional context, such as in an `if' or in a `while'.
Directly inherits:
BasitType
Exports:
Test used in conditional context. |
|
from BasicType | |
[default] from BasicType | |
from BasicType | |
[default] from BasicType | |
from BasicType | |
[default] from BasicType |
Definition:
define Conditional: Category == BasicType with { test: % -> Boolean; }
25.8 : ElementaryFunctions
Description:
`ElementaryFunctions' provides the basic trigonometric and exponential function and their inverses.
Directly inherits:
(none)
Exports:
General exponentiation. |
|
Exponential of `e'. |
|
Natural logarithm. |
|
Logarithm base 10. |
|
Circular trigonometric sine, cosine, tangent. |
|
Hyperbolic trigonometric sine, cosine, tangent. |
|
Functional inverse of `sin', `cos', `tan'. |
|
functional inverse of `sinh', `cosh', `tanh'. |
|
Square root. |
|
General surd. |
Definition:
define ElementaryFunction: Category == with { exp: % -> %; sin: % -> %; cos: % -> %; tan: % -> %; sinh: % -> %; cosh: % -> %; tanh: % -> %; log: % -> %; log10: % -> %; asin: % -> %; acos: % -> %; atan: % -> %; asinh: % -> %; acosh: % -> %; atanh: % -> %; sqrt: % -> %; root: (%, SingleInteger) -> %; ^: (%, %) -> %; }
25.9 : EuclideanDomain
Description:
`ElementaryFunctions' provides the basic trigonometric and exponential
Directly inherits:
Ring
Exports:
from ArithmeticSystem | |
from ArithmeticSystem | |
[default]from ArithmeticSystem | |
from ArithmeticSystem | |
from ArithmeticSystem | |
[default] from ArithmeticSystem | |
from ArithmeticSystem | |
from ArithmeticSystem | |
from ArithmeticSystem | |
from ArithmeticSystem | |
from BasicType | |
[default] from BasicType | |
from BasicType | |
[default] from BasicType | |
[default] from AbelianMonoid | |
Greatest common divisor. |
|
Quotient leaving remainder. |
|
Remainder. |
|
Quotient-remainder pair. |
[default] |
[default] from BasicType | |
[default] from BasicType |
Definition:
define EuclideanDomain: Category == Ring with { gcd: (%, %) -> %; quo: (%, %) -> %; rem: (%, %) -> %; divide: (%, %) -> (%, %); default divide(a: %, b: %): (%, %) == (a quo b, a rem b); {
25.10 : Field
Description:
`Field' prvides arithmetic with division.
Directly inherits:
EuclideanDomain, Group
Exports:
Division: a / b = a * inv(b). |
[default] |
Division: a \ b = inv(a) * b. |
[default] |
Inverse. |
|
from ArithmeticSystem | |
from ArithmeticSystem | |
[default]from ArithmeticSystem | |
from ArithmeticSystem | |
from ArithmeticSystem | |
[default] from ArithmeticSystem | |
from ArithmeticSystem | |
from ArithmeticSystem | |
from ArithmeticSystem | |
from ArithmeticSystem | |
from BasicType | |
[default] from BasicType | |
from BasicType | |
[default] from BasicType | |
[default] from AbelianMonoid | |
[default] from EuclideanDomain | |
[default] from EuclideanDomain | |
[default] from EuclideanDomain | |
[default] from EuclideanDomain | |
[default] from BasicType | |
[default] from BasicType |
Definition:
define Field: Category == Join(EuclideanDomain, Group) with { default { gcd(a: %, b: %): % == {zero? a and zero? b => 0; 1} (a: %) quo (b: %): % == a/b; (a: %) rem (b: %): % == 0; } }
25.11 : Finite
Description:
`Finite' indicates that a type has only a finite number of values
Directly inherits:
BasicType
Exports:
Number of values in the type. |
|
from BasicType | |
[default] from BasicType | |
from BasicType | |
[default] from BasicType | |
from BasicType | |
[default] from BasicType |
Definitoin:
define Finite: Category == BasicType with { #: Integer; }
25.12 : FiniteAggregateS
Description:
`FiniteAggregate(S)' provides operations for manipulating structures representing finite collections of values of type `S'.
Parameter:
Directly inherits:
Aggregate(S)
Exports:
Count of the number of elements. |
|
from BasicType | |
[default] from BasicType | |
from BasicType | |
[default] from BasicType | |
from BasicType | |
[default] from BasicType | |
[default] from Aggregate(S) | |
from Aggregate(S) | |
from Aggregate(S) |
Definition:
define FiniteAggregate(S: Type): Category == Aggregate S with { #: # -> SingleInteger; default empty? (a: %) : Boolean == { import from SingleInteger, Machine; ((#a)::SInt = 0)::Boolean; } }
25.13 : FiniteField
Description:
`FiniteField provides arithmetic on a finite set.
Directly inherits:
Finite, Field
Exports:
from BasicType | |
[default] from BasicType | |
from BasicType | |
[default] from BasicType | |
[default] from BasicType | |
[default] from BasicType | |
from Finite | |
from ArithmeticSystem | |
[default] from ArithmeticSystem | |
from ArithmeticSystem | |
from ArithmeticSystem | |
[default] from ArithmeticSystem | |
from ArithmeticSystem | |
from ArithmeticSystem | |
from ArithmeticSystem | |
from ArithmeticSystem | |
from ArithmeticSystem | |
[default] from AbelianMonoid | |
[default] from EuclideanDomain | |
[default] from EuclideanDomain | |
[default] from EuclideanDomain | |
[default] from EuclideanDomain | |
[default] from Group | |
[default] from Group | |
from Group |
Definition:
define FiniteField: Category == Join(Finite, Field) with { integer:Literal -> %; reduce: SingleInteger -> %; lift: % -> SingleInteger; }
25.14 : FiniteLinearAggregate S
Description:
`FiniteLinearAggregate(S)' provides operations for manipulating structures representing finite linear collections of values of type `S'.
Parameter:
Direclty inherits:
FiniteAggregate(S), Linear Aggregate(S)
Exports:
from BasicType | |
[default] from BasicType | |
from BasicType | |
[default] from BasicType | |
from BasicType | |
[default] from BasicType | |
[default] from Aggregate(S) | |
from Aggregate(S) | |
from Aggregate(S) | |
from FiniteAggregate(S) | |
[default] from LinearAggregate(S) | |
LinearAggregate(S) | |
LinearAggregate(S) | |
[default] LinearAggregate(S) | |
LinearAggregate(S) |
Definition:
define FiniteLinearAggregate(S: Type): Category == Join(FiniteAggregate S, LinearAggregate S);
25.15 : FloatingPointNumberSystem
Description:
`FloatingPointNumberSystem' provides the basic operations for a type which approximates the real n8umbers as a floating point system.
Directly inherits:
OrderedRing, Field
Exports:
Floating point-style literals. |
|
Insignificance: a << b => a + b = b |
|
Dominance: a >> b => a + b = a |
|
`step(n)(a,b)' yields `n' evenly separated values on `a, b' |
|
from BasicType | |
[default] from BasicType | |
from BasicType | |
[default] from BasicType | |
from BasicType | |
[default] from BasicType | |
from Order | |
[default] from Order | |
[default] from Order | |
[default] from Order | |
[default] from Order | |
from AbelianMonoid | |
[default from AbelianMonoid | |
from AbelianMonoid | |
[default] from AbelianMonoid | |
from AbelianGroup | |
[default] from AbelianGroup | |
from ArithmeticSystem | |
from ArithmeticSystem | |
from ArithmeticSystem | |
from ArithmeticSystem | |
from ArithmeticSystem | |
[default] from OrderedRing | |
[default] from OrderedRing | |
[default] from OrderedRing | |
[default] from OrderedRing | |
[default] from EuclideanDomain | |
[default] from EuclideanDomain | |
[default] from EuclideanDomain | |
[default] from EuclideanDomain | |
[default] from Group | |
[default] from Group | |
from Group |
Definition:
define FloatingPointNumberSystem: Category == Join(OrderedRing, Field) with { float: Literal -> %; <<: (%, %) -> Boolean; >>: (%, %) -> Boolean; coerce: Integer -> %; coerce: SingleInteger -> %; step: SingleInteger -> (%, %) -> Generator %; }
25.16 : Group
Description:
`Group' provides multiplicative arithmetic with division.
Directly inherits:
Monoid
Exports:
Division: a / b = a*inv(b). |
[default] |
Division: a \ b = inv(a)*b. |
[default] |
Inverse. |
|
from BasicType | |
[default] from BasicType | |
from BasicType | |
[default] from BasicType | |
from BasicType | |
[default] from BasicType | |
from Monoid | |
from monoid | |
from Monoid |
Definition:
define Group: Category == Monoid with { /: (%, %) -> %; \: (%, %) -> %; inv: % -> %; default (a: %) / (b: %): % == a * inv b; default (a: %) \ (b: %): % == inv a * b;
25.17 : IntegerNumberSystem
Description:
`IntegerNumberSystem' provides the basic operations for a type which represents a range of integers.
Directly inherits:
OrderedRing, EuclideanDomain
Exports:
Integer-style literals. |
|
Tests whether the value is even or odd. |
|
`single?(v) returns true if a SingleInteger can hold the value `v'. |
|
Decrement/increment the value by 1. |
|
Modulus. |
|
Length in bits. |
|
Shift by the a number of bits. |
|
Extract the desired bit. |
|
Covert to SingleInteger, if can. |
|
from BasicType | |
[default] from BasicType | |
from BasicType | |
[default] from BasicType | |
from BasicType | |
[default] from BasicType | |
from Order | |
[default] from Order | |
[default] from Order | |
[default] from Order | |
[default] from Order | |
from AbelianMonoid | |
[default from AbelianMonoid | |
from AbelianMonoid | |
[default] from AbelianMonoid | |
from AbelianGroup | |
[default] from AbelianGroup | |
from ArithmeticSystem | |
from ArithmeticSystem | |
from ArithmeticSystem | |
from ArithmeticSystem | |
from ArithmeticSystem | |
[default] from OrderedRing | |
[default] from OrderedRing | |
[default] from OrderedRing | |
[default] from OrderedRing | |
[default] from EuclideanDomain | |
[default] from EuclideanDomain | |
[default] from EuclideanDomain | |
[default] from EuclideanDomain |
Definition:
define IntegerNumberSystem: Category == Join(OrderedRing,EuclideanDomain) with { integer: Literal -> %; even?: % -> Boolean; odd?: % -> Boolean: single?: % -> Boolean: prev: % -> %; next: % -> %; mod: (%, %) -> %; length: % -> SingleInteger; shift: (%, SingleInteger) -> %; bit: (%, SingleINteger) -> Boolean; retract: % -> SingleInteger; }
25.18 : LinearAggregate S
Description:
`LinearAggregate(S)' provides operations for manipulating structures representing linear collections of values of type `S'.
Parameter:
Directly inherits:
Aggregate(S)
Exports:
Construction with no values. |
[default] |
Construction from a generator. |
|
Construction from a tuple. |
|
Element-wise combination. |
[default] |
from BasicType | |
[default] from BasicType | |
from BasicType | |
[default] from BasicType | |
from BasicType | |
[default] from BasicType | |
from Aggregate(S) | |
from Aggregate(S) | |
[default]from Aggregate(S) |
Definition:
define LinearAggregate(S: Type): Category == Aggregate S with { empty: () -> %; bracket: Generator S -> %; bracket: Tuple S -> %; map: ((S,S)->S, %, %) -> %; apply: (%, SingleINteger) -> S; default { empty(): % == []; map (f: S -> S, a:%): % == [f x for x in a]; map (f: (S,S)->S, a: %, b: %): % == } }
25.19 : ListCategory S
Description:
`ListCategory' provides the basic operations for linked lists.
Parameter:
Directly inherits:
FiniteLinearAggregate(S), Conditional
Exports:
nil is a literal constant that is an empty list. |
|
`cons(s,k)' appends `s' to the front of the list `k'. |
|
Generates a list from a tuple or a generator of `S'. |
|
`first(k)' returns the first element of the list `k'. `rest(k)' returns the list consisting of all elements of k after the first. |
|
`setFirst!(k, s)' destructively modifies the list `k' so that the first element is `s'. `setRest!(k1, k2) destructively modifies the list `k1' so that rest(k1) = k2. |
|
`l.first' is equivalent to `first(l)'. `l.rest' is equivalent to `rest(l)'. |
|
`l.first := v' is equivalent to `setFirst!(l,v)'. `l.rest := t' is equivalent to `setRest!(l, v, t)'. |
|
`copy(k)' returns a copy of the list `k'. |
|
`last(k)' returns the last element of the list `k'. |
|
`reverse(k)' non-destructively reverses the elements of `k'. `reverse!(k)' destructively reverses the elements of k. |
|
`concat(k1,k2)' returns a new list that contains the elements of `k1' appended to the front of`k2'. `concat!(k1,k2)' destructively (to `k1') appends `k1' to the front of `k2'. |
|
`reduce(fun,k,s)' computes `r1 = fun(first k, s)', then `r2 = (fun first rest k, r1)' and so, returning the final value computed. |
|
`member?(s,k)' returns true if `s' is contained in `k', false otherwise. |
|
`rest(k,i)' drops the first `i' elements from `k'. |
|
`tails(k)' returns the successive tails of `k'. Clients are allowed to call setFirst! and setRest! on the generated values. |
|
`dispose!(1)' indicates the list `l' will no longer be used. |
|
from BasicType | |
[default] from BasicType | |
from BasicType | |
[default] from BasicType | |
from BasicType | |
[default] from BasicType | |
from Aggregate(S) | |
from Aggregate(S) | |
[default]from Aggregate(S) | |
from FiniteAggregate(S) | |
[default] from LinearAggregate(S) | |
from LinearAggregate(S) | |
from LinearAggregate(S) | |
[default] from LinearAggregate(S) | |
from LinearAggregate(S) | |
from Conditional |
Definition:
== Join(FiniteLinearAggregate S, Conditional) with { export from 'first'; export from 'rest'; nil: %; cons: (S, %) -> %; first: % -> S; rest: % -> %; setFirst!: (%, S) -> S; setRest!: (%, %) -> %; apply: (%, 'first') -> S; apply: (%, 'rest') -> %; copy: % -> %; last: % -> S; reverse: % -> %; reverse!: % -> %; concat!: (%, %) -> %; concat: (%, %) -> %; reduce: ((S, S) -> (S, %, S) -> S; member?: (S, %) -> Boolean; rest: (%, SingleINteger) -> %; tails: % -> Generator %; dispose!: % -> (); disposeHead!: % -> %; }
25.20 : Logic
Description:
`Logic' provides the basic operations for lattices, e.g. Booleal algebra.
Directly inherits:
BasicType
Exports:
Logical complement |
|
Locical `meet', e.g. `and' |
|
Logical `join', e.g. `or'. |
[default] |
from BasicType | |
[default] from BasicType | |
from BasicType | |
[default] from BasicType | |
from BasicType | |
[default] from BasicType |
Definition:
define Logic: Category == BasicType with { ~: % -> %; /\: (%, %) -> %; \/: (%, %) -> %; }
25.21 : Monoid
Description:
`Monoid' provides multiplicative arithmetic.
Directly inherits:
BasicType
Exports:
Identity for multiplication. | |
Multiplication. |
|
Exponentiation or error. |
|
from BasicType | |
[default] from BasicType | |
from BasicType | |
[default] from BasicType | |
from BasicType | |
from BasicType |
Definition:
define Monoid: Category == BasicType with { 1: %; *: (%, %) -> %; ^: (%, Integer) -> %; }
25.22 : Order
Description:
`Order' provides operations for an order relation, `>', and its dual, `<'.
Direclty inherits:
BasicType
Exports:
[default] | |
[default] | |
[default] | |
[default] | |
Maximum and minimu argument. |
[default] |
Greater than test. |
[default] |
Less tahn test. |
[default] |
Greater tahn or equal test. |
[default] |
Less than or equal test. |
[default] |
[default] | |
[default] | |
[default] | |
[default] | |
[default] | |
[default] | |
[default] | |
[default] | |
from BasicType | |
[default] from BasicType | |
from BasicType | |
[default] from BasicType | |
from BasicType | |
from BasicType |
Definition:
define Order: Category == BasicType with { >: (%, %) -> Boolean; <: (%, %) -> Boolean; >=: (%, %) -> Boolean <=: (%, %) -> Boolean max: (%, %) -> % min: (%, %) -> % default { (x: %) < (y: %): Bolean == y > x; (x: %) >= (y: %): not (x < y); (x: %) >= (y: %): not (x > y); max(x: %, y: %): % == if x > y then x else y; min(x: %, y: %): % == if x < y then x else y; } default { -- These allow sequences, /eg{}: 0 <= i < n; B% ==> Cross(Boolean, %); (x: %) > (y: %): B% == (x > y, y); (x: %) < (y: %): B% == (x < y, y); (x: %) >= (y: %): B% == (x >= y, y); (x: %) <= (y: %): B% == (x <= y, y); (bx: B%) > (y: %): B% == {(b,x) := bx; (b and x > y, y)} (bx: B%) < (y: %): B% == {(b,x) := bx; (b and x < y, y)} (bx: B%) >= (y: %): B% == {(b,x) := bx; (b and x >= y, y)} (bx: B%) <= (y: %): B% == {(b,x) := bx; (b and x <= y, y)} (bx: B%) > (y: %): Boolean == {(b,x):=bx; b and x > y} (bx: B%) < (y: %): Boolean == {(b,x):=bx; b and x < y} (bx: B%) >= (y: %): Boolean == {(b,x):=bx; b and x >= y} (bx: B%) <= (y: %): Boolean == {(b,x):=bx; b and x <= y} } }
25.23 : OrderedAbelianGroup
Description:
`OrderedAbelianGroup' provides group operations consitent with an order.
Directly inherits:
OrderedAbelianMonoid, AbelianGroup
Exports:
from BasicType | |
[default] from BasicType | |
from BasicType | |
[default] from BasicType | |
from BasicType | |
from BasicType | |
from Order | |
[default] from Order | |
[default] from Order | |
[default] from Order | |
[default] from Order | |
from AbelianMonoid | |
[default from AbelianMonoid | |
from AbelianMonoid | |
[default] from AbelianMonoid | |
from AbelianGroup | |
[default] from AbelianGroup |
Definition:
define OrderedAbelianGroup: Category == Jon(OrderedAbelianMonoid, AbelianGroup);
25.24 : OrderedAbelianMonoid
Description:
`OrderedAbelianMonoid' provides an addition consitent with an order.
Directly inherits:
Order, AbelianMonoid
Exports:
from BasicType | |
[default] from BasicType | |
from BasicType | |
[default] from BasicType | |
from BasicType | |
from BasicType | |
from Order | |
[default] from Order | |
[default] from Order | |
[default] from Order | |
[default] from Order | |
from AbelianMonoid | |
[default from AbelianMonoid | |
from AbelianMonoid | |
[default] from AbelianMonoid |
Definition:
define OrderedAbelianMonoid: Category == Join(Order, AbelianMonoid);
25.25 : OrderedFinite
Description:
`OrderedFinite' provides the minimum and maximum valoues for a finite type.
Directly inherits:
Finite, Order
Exports:
Minimum and maximum value belonging to the type |
|
from BasicType | |
[default] from BasicType | |
from BasicType | |
[default] from BasicType | |
from BasicType | |
from BasicType | |
from Finite | |
from Order | |
[default] from Order | |
[default] from Order | |
[default] from Order | |
[default] from Order |
Definition:
define OrderedFinite: Category == Join(Finite, Order) with { min: %; max: %; }
25.26 : OrderedRing
Description:
`OrderedRing' provides arithmetic consitent with an ordering.
Directly inherits:
OrderedAbelianGroup, Ring
Exports:
Absolute value. |
[default] |
-1, 0 or 1. |
[default] |
Test whether value is negative. |
[default] |
from BasicType | |
[default] from BasicType | |
from BasicType | |
[default] from BasicType | |
from BasicType | |
[default] from BasicType | |
from Order | |
[default] from Order | |
[default] from Order | |
[default] from Order | |
[default] from Order | |
from AbelianMonoid | |
[default from AbelianMonoid | |
from AbelianMonoid | |
[default] from AbelianMonoid | |
from AbelianGroup | |
[default] from AbelianGroup | |
from ArithmeticSystem | |
from ArithmeticSystem | |
from ArithmeticSystem | |
from ArithmeticSystem |
Definition:
define Orderedring: Category == Join(OrderedAbelianGroup, Ring) with { abs: % -> %; sign: % -> %; negative?: % -> Boolean; positive?: % -> Boolean; default { abs (x: %): % == if x > 0 then x else -x; sign(x: %): % == {x > 0 => 1; x < 0 => -1; 0} negative?(x: %) : Boolean == x < 0; positive?(x: %) : Boolean == x > 0; } }
25.27 : Ring
Description:
`Ring' provides the basic arithmetic operations of addition, subtraction and multiplication.
Directly inherits:
Arithmeticsystem, Monoid, AbelianGroup
Exports:
from ArithmeticSystem | |
[default] from ArithmeticSystem | |
from ArithmeticSystem | |
from ArithmeticSystem | |
[default] from ArithmeticSystem | |
from ArithmeticSystem | |
from ArithmeticSystem | |
from ArithmeticSystem | |
from ArithmeticSystem | |
from ArithmeticSystem | |
from BasicType | |
[default] from BasicType | |
from BasicType | |
[default] from BasicType | |
[default] from BasicType | |
[default] from BasicType | |
[default] from AbelianMonoid |
Definition:
define Ring: Category == Join(ArithmeticSystem, Monoid, AbelianGroup);
25.28 : Steppable
Description:
`Steppable' provides skuposrt for segments: discrete sets of values hwich can be stepped over in order.
Directly inherits
OrderedRing
Exports:
`stepsBetween(a,b,n)' returns the number os steps between a and b at intervals of n. |
|
`stepsBetween(a,b)' returns the number of steps between a and b |
[default] |
from BasicType | |
[default] from BasicType | |
from BasicType | |
[default] from BasicType | |
from BasicType | |
[default] from BasicType | |
from Order | |
[default] from Order | |
[default] from Order | |
[default] from Order | |
[default] from Order | |
from AbelianMonoid | |
[default from AbelianMonoid | |
from AbelianMonoid | |
[default] from AbelianMonoid | |
from AbelianGroup | |
[default] from AbelianGroup | |
from ArithmeticSystem | |
from ArithmeticSystem | |
from ArithmeticSystem | |
from ArithmeticSystem | |
[default] from OrderedRing | |
[default] from OrderedRing | |
[default] from OrderedRing | |
[default] from OrderedRing |
Definition:
define Steppable: Category == OrderedRing with { stepsBetween: (%, %, %) -> SingleInteger; stepsBetween: (%,%) -> SingleInteger; default stepsBetween(x: %, y: %): SingleInteger == { stepsBetween(x, y, 1); } }