Hi Bill,
I turned exports into a function, as you'd probably want to
call it more than once.
I don't understand the relevance of whether exports is a function
or not. As a generator we can use it as often as we like. No?
Try the following piece of code.
---BEGIN aaa14.as
#include "aldor"
#include "aldorio"
main(): () == {
import from Integer, List Integer;
fun(): Generator Integer == generate {
yield 0;
yield 1;
};
const: Generator Integer == fun();
stdout << [fun()] << newline;
stdout << [fun()] << newline;
stdout << [const] << newline;
stdout << [const] << newline;
}
main();
---END aaa14
>aldor -grun -laldor aaa14.as
[0,1]
[0,1]
[0,1]
[]
I agree that const is not constant. But a Generator is inherently
destructive.
If you like you could also say something like
a: Record(x: Integer) == [1];
a.x := 0;
and the "constant" a changes. But you should note that the last line is
actually
set!(a, x, 0)
so that is a destructive function and thus you should expect strange
things. The BANG functions (like set!) are only for people who know what
they do.
Ralf
_______________________________________________
Axiom-developer mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/axiom-developer