axiom-math
[Top][All Lists]
Advanced

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

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


From: Ralf Hemmecke
Subject: [Axiom-math] Re: [open-axiom-devel] generators
Date: Wed, 24 Oct 2007 23:55:28 +0200
User-agent: Thunderbird 2.0.0.6 (X11/20070728)

Just curious: can something of type Generator(Something) ever be a domain?
(Probably yes...)

>aldor -fx -laldor aaa.as
>aaa
MachineInteger
123

---BEGIN aaa.as
#include "aldor"
#include "aldorio"

CAT ==> OutputType with {integer: Literal -> %}
g(): Generator(CAT) == generate {
        yield MachineInteger;
--      yield Integer;
}

foo(D: CAT): () == {
        import from D, TextWriter, String, Character;
        stdout << name(D)$Trace << newline;
        stdout << (address@hidden) << newline;
}

for D in g() repeat foo(D);
---END aaa.as

But don't remove the -- before "yield Integer", because then the compiler tells you... :-(

"aaa.as", line 5: g(): Generator(CAT) == generate {
                  ................................^
[L5 C33] #1 (Fatal Error) Compiler bug: no exit list for terrorSequence (ooops).

Since in Aldor domains are first class, it should be possible to return them by a generator. (Compare to lists of domains.)

However, your question asks whether g is a domain if

  g: Generator(Something)

and I would tend to say that this is not a domain. Why? Well, "Generator(Something)" should be a category then, right? But if you look int sal_gener.as you clearly see that Generator(T) is a domain.

Ralf





reply via email to

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