[Aldor-l] Generators (destructuring cross)
Ralf Hemmecke
ralf at hemmecke.de
Thu Nov 8 03:57:52 EST 2007
On 11/07/2007 08:07 PM, Martin Rubey wrote:
> I just noticed that
>
> -DWantRuntimeError
>
> works, only
>
> -DWantRuntimeError -Ddebug
> produces a runtime error. So, maybe there is hope? The error message is
Shouldn't you give -dDEBUG instead of -ddebug? Anyway, I get the same
error with
aldor -fx -DWantRuntimeError -I$ALDORROOT/include -Y$ALDORROOT/lib
-dDEBUG -lalgebrad -laldord crossiterator.as
Ralf
> Unhandled Exception: RuntimeError()
> Assert failed in sit_spf0, at line:28: p > 1
>
> Martin
>
>
> Martin Rubey <martin.rubey at univie.ac.at> writes:
>
>> aldor -fx -lalgebra -laldor ~/aldor-test/crossiterator.as
>> -------------------------------------------------------------------------------
>> #include "aldor"
>> #include "algebra"
>> #include "aldorio"
>>
>> --#include "axiom"
>> Cr ==> Cross(n: MachineInteger, SmallPrimeField n);
>> D ==> Record(n: MachineInteger, s:SmallPrimeField n);
>>
>> f(p: MachineInteger, m: MachineInteger): D == {
>> import from SmallPrimeField p;
>> e := [p, m::SmallPrimeField p]$D;
>> }
>>
>> g: Generator Cr == generate {
>> import from MachineInteger, Cr;
>> yield explode(f(3, 5))$D;
>> yield explode(f(5, 5))$D;
>> }
>>
>> h: Generator Cross(MachineInteger, String, SmallPrimeField 5) == generate {
>> import from MachineInteger, String, SmallPrimeField 5;
>> yield (3, "drei", 3::SmallPrimeField 5);
>> yield (8, "acht", 8::SmallPrimeField 5);
>> }
>>
>> i: Generator Cross(MachineInteger, MachineInteger) == generate {
>> import from MachineInteger;
>> yield (2, 3);
>> yield (4, 5);
>> yield (6, 7);
>> }
>>
>> bug(): () == {
>> import from MachineInteger, Cr, List Cr;
>> d1: D := f(3, 5);
>> c1: Cr := explode(d1)$D;
>> l: List Cr := [c1];
>> }
>>
>> main(): () == {
>> import from MachineInteger, Cr, Generator Cr;
>> #if WantSegfault
>> bug();
>> #endif
>> stdout << "test dependent, old style:" << newline;
>> for i in g repeat {
>> (a: MachineInteger, b: SmallPrimeField(a)) == i;
>> stdout << a << newline;
>> #if WantRuntimeError
>> stdout << b << newline;
>> #endif
>> }
>>
>> #if DoesntCompile
>> stdout << "test dependent:" << newline;
>> for (a, b) in g repeat {
>> stdout << a << newline;
>> }
>> #endif
>> stdout << "test Cartesian:" << newline;
>> import from SmallPrimeField 5;
>> for (a, b, c) in h repeat {
>> stdout << a << " " << b << " " << c << newline;
>> }
>>
>> stdout << "test Cartesian List:" << newline;
>> import from List MachineInteger;
>> stdout << [a*b for (a, b) in i] << newline;
>>
>> }
>>
>> main();
>>
>>
>>
>> _______________________________________________
>> Aldor-l mailing list
>> Aldor-l at aldor.org
>> http://aldor.org/mailman/listinfo/aldor-l_aldor.org
>
>
> _______________________________________________
> Aldor-l mailing list
> Aldor-l at aldor.org
> http://aldor.org/mailman/listinfo/aldor-l_aldor.org
More information about the Aldor-l
mailing list