> f(m: INT, n: INT): PF n == m::PF(n)
that's OK.
> [f(100, n) for n in primes(1,100)]
that's stupid.
Why? I would think it is an element (not a list) in a cartesian product
of #primes(1,100) prime fields.
OK, if you like. But then I would like to see the definition of the
bracket function. Can you give that?
I strongly believe you can't, because that would require Aldor to
compute "primes(1,100)" at compile time. Which is currently not possible
and if the compiler is allowed to evaluate it then it might run into an
infinite loop (at compile time) since the "primes" function does not
terminate as you would expect. Compile time evaluation in full
generality introduces a way make it really hard to find bugs.
But anyway, maybe Aldor should allow compile time evaluation.
Ask yourself, what type that list will have and you realise that
Aldor will
reject that its compilation.
Excuse me, Gaby. Sorry about being so stupid.
It's a perfectly good mathematical object in a cartesian product.
William is right, but I cannot believe that a construction like
[f(100, n) for n in [2,3,5]$List(Integer)]
would work.
[f(100, n), f(100, n), f(100, n)]
should be easily definable and give an element in the cartesian product
of PF(2), PF(3), and PF(5). But that is a finite construct and not
done via Generator as above.
> [a::P for P in L]
That is as problematic as the first list.
"problematic" is an understatement. Sorry.
Ditto. The only problem I see that can't be handled is if you make it
into a function of k:
[f(100, n) for n in primes(1,k)]
Initially, I believe, Martin wanted lists. What you are calling for is a
cartesian product constructor of the form.
PFCartesian(k: Integer): with {
coerce: ((n: Integer) -> PF(n)) -> %;
...
} == add {
...
}
Then instead of [f(100, n) for n in primes(1,k)] it would be more
appropriate to define
k: Integer == << stdin; -- read from standard input and make it constant
foo(m: Integer)(n: Integer): PF(n) == m :: PF(n);
import from PFCartesian(k);
z := foo(42) :: PFCartesian(k);
Such a construction would work, but it does not involve a Generator or
something that you must compute at compile time.
Ralf
_______________________________________________
Axiom-developer mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/axiom-developer