Hi Cliff,
Looking ahead to units:
Let's say I multiply meters:Length and seconds:Time together. I want
to end up with meters*seconds:Length*Time, which is both a new unit and
a new dimensional type.
What do you think the code
main(): () == {
a: Length := 2 centimeter;
b: Time := 3 hour;
c: (Length * Time) := a * b;
import from Length * Time * Time;
d := c * 3 second;
stdout << "a = " << a << newline;
stdout << "b = " << b << newline;
stdout << "c = " << c << newline;
stdout << "d = " << d << newline;
}
that I sent before represents?
Look at the line
c: (Length * Time) := a * b;
It constructs a type Length*Time and imports the operations from that
NEW domain. Only after that import it is clear what the * on the right
hand side actually is. The * on the left and the * on the right hand
side are terribly different. The first is of type
(Dimension, Dimension) -> Dimension
and the second of type
(Length, Time) -> Length*Time;
And my code is unable to do something like
Integer * String
because neither Integer nor String is of type Dimension, so the (first)
* cannot apply.
Take your time and study my code in detail. At each step you should
understand what it is doing.
For example, do you know why I could simply write
a: Length := 2 centimeter;
? There is only a space between 2 and centimeter.
Ralf
_______________________________________________
Axiom-developer mailing list
Axiom-developer@nongnu.org
http://lists.nongnu.org/mailman/listinfo/axiom-developer