Re: [open-axiom-devel] [fricas-devel] Re: [fricas-devel] Re: [fricas-devel] Re: iterators and cartesian product.
Ralf Hemmecke <[email protected]> Thu, 25 Oct 2007 00:25:32 +0200
| Newsgroups | gmane.comp.mathematics.axiom.general |
|---|---|
| Message-ID | <[email protected]> |
> | '1..' is another (better?) name for PositiveInteger
>
> No, it is not. Both behave quite differently in many situations.
What?
Suppose I have given
PositiveIntegerCategory
and suppose
PositiveInteger: PositiveIntegerCategory == add {...}
then
(..)(i: Integer): PositiveIntegerCategory == PositiveInteger
For simplicity I simply ignore the parameter and in the following I
simply use an existing "IntegerType" from LibAldor.
---BEGIN aaa.as
#include "aldor"
#include "aldorio"
PositiveInteger: IntegerType == Integer add;
(..)(i: Integer): IntegerType == PositiveInteger add;
one:*Integer == 1$Integer;
import from one..;
stdout << 3 << newline;
---END aaa.as
(I don't import from Integer since I use ":*" instead of ":". Remove the
* and see what the compiler tells you.)
Add the line
for i in one.. repeat stdout << i << newline;
to the program above and try to compile. Of course it must fail.
>aldor -fx -laldor aaa.as
"aaa.as", line 9: for i in one.. repeat stdout << i << newline;
....^.......^
[L9 C5] #2 (Error) No meaning for identifier `i'.
[L9 C13] #1 (Error) Argument 1 of `generator' did not match any possible
parameter type.
The rejected type is
IntegerType with
== Posi....
Expected type String.
Since there is no function (..) which returns a Generator(Something).
But still, I cannot see, why
one..
behaves in any way different from PositiveInteger.
OK, you speak of SPAD and I demonstrated Aldor, so I should be quiet.
Ralf