[Aldor-l] Generators

Martin Rubey martin.rubey at univie.ac.at
Tue Nov 13 01:59:17 EST 2007


Peter Broadbery <p_broadbery at hotmail.com> writes:

> > I don't know whether we said it in tha AUG, but it is intended that you
> > cannot assign to loop variables inside the loop.
> >
> > Consequently they can be used in type expressions and having dependent
> > crosses as "for" indices should be allowed.

Oh, that's interesting.  So 

        for i in g repeat {
                (a: MachineInteger, b: SmallPrimeField(a)) == i;
                stdout << a << newline;
                stdout << b << newline;
        }

should be OK?  But it doesn't work with -DDEBUG...

> Unfortunately, the compiler isn't keen on them being used in types.  
> 
> "bug2.as", line 10:        (x, 0$SPF(x)) for x in 1..10;
>                     .........................^
> [L10 C26] #1 (Error) `x' is used in a type, so must be constant, and so cannot be assigned to.
> 
> This seems to be built into scobind.c. I'll hit it with a stick & see what
> happens..

That would be great!

Another mistery, at least to me:  Bill sent this snippet:

       stdout << "test dependent:" << newline;
       for (a:MachineInteger, b:SmallPrimeField a) in g repeat {
               stdout << a << " " << b << newline;
       }

root at sage:~/aldor-src/aldor/install/aldor# aldor -fx  -lalgebra
-laldor crossiterator.as
"crossiterator.as", line 63:
       for (a:MachineInteger, b:SmallPrimeField a) in g repeat {
............^
[L63 C13] #1 (Error) `a' is used in a type, so must be constant, and
so cannot be assigned to.

Any idea why it's C13 here and C26 above?

Martin





More information about the Aldor-l mailing list