[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Axiom-developer] Re: Dimensions as types...
From: |
Martin Rubey |
Subject: |
Re: [Axiom-developer] Re: Dimensions as types... |
Date: |
29 Aug 2006 15:32:57 +0200 |
User-agent: |
Gnus/5.09 (Gnus v5.9.0) Emacs/21.3 |
C Y <address@hidden> writes:
> Well, I think it's just that I'm not thinking clearly enough yet in
> Aldor. I was thinking maybe something like (warning, pseudocode, maybe
> even conceptually wrong)
>
> define Dimension: Category == with {
> "*" : (%,%) -> %
> }
>
> DerivedDimension: AbelianGroup with {
> "*": (A: Dimension, B: Dimension) -> C: Dimension
> "^": (D: Dimension, E: Integer) -> F: Dimension
> } == add{
> ***Some A*B operation that returns C according to Abelian rules***
> }
I just wanted to point out that you can give the Aldor Category "Dimension" an
algebraic structure. This is in fact one of the main advantages of Aldor over
SPAD.
The code will read roughly as follows:
Scalar: Dimension with {
scalar: %;
} == AuxiliaryDimension add {
scalar: % == [1, ""];
}
DimensionThing: Group == add {
Rep == Dimension;
1: % == per ConstantDimension;
(x: %) * (y: %): % == per(x * y);
(x: %) / (y: %): % == ...
}
Thus, each "element" in the domain DimensionThing has type
Dimension. Multiplying two dimensions gives you another dimension. The unit
(i.e., neutral) element is the "dimension" Scalar.
Keep in mind: in Aldor, types are first class. They even can be the elements of
a domain.
Martin
[Axiom-developer] Re: Dimensions as types..., C Y, 2006/08/29
Re: [Axiom-developer] Re: Dimensions as types...,
Martin Rubey <=