axiom-math
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Axiom-math] Re: [fricas-devel] Re: [open-axiom-devel] [fricas-devel] Re


From: Bill Page
Subject: [Axiom-math] Re: [fricas-devel] Re: [open-axiom-devel] [fricas-devel] Re: [fricas-devel] Re: [fricas-devel] Re: iterators and cartesian product.
Date: Thu, 25 Oct 2007 12:50:14 -0400

On 10/24/07, Ralf Hemmecke wrote:
>
> > |   '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 {...}
>

In the existing Axiom library PositiveInteger is a subdomain of
Integer. The Axiom interpreter infers the following domain

  UniversalSegment PositiveInteger

of the expression '1..'. 'UniversalSegment(S)' includes an operation
'expand' that returns a Stream(S) provided S had OrderedRing.

> 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.
>

The point is that '1..' as a 'UniversalSegment' provides only certain
specific exports which differ from those available in
'PositiveInteger'. In my previous reply to Gaby I admitted that what I
probably want is that all of the (or equivalent) exports of
'UniversalSegment(PositiveInteger)'  should already be available in
'PositiveInteger' as the "standard" method of implementing what is now
available via 'StepThrough'.

> OK, you speak of SPAD and I demonstrated Aldor, so I should be quiet.
>

I do really appreciate your comments. Thanks.

Regards,
Bill Page.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]