axiom-developer
[Top][All Lists]
Advanced

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

Re: [Axiom-developer] Nested functions in SPAD


From: hemmecke
Subject: Re: [Axiom-developer] Nested functions in SPAD
Date: Sat, 7 Oct 2006 22:08:09 +0200 (CEST)
User-agent: SquirrelMail/1.4.3a

> Waldek Hebisch <address@hidden> writes:
>
> | Gabriel Dos Reis wrote:
> | > Try:
> | >     goodCoef(v, l, s) ==
> | >       -- if k1 is part of k2 we should not express k1 in terms of k2
> | >       -- (othewise we would get infinite recursion)
> | >       -- below we impose a stronger condition: we require
> | >       -- height(k1) to be maximal
> | >       h:NonNegativeInteger := 0
> | >       j:Integer := 0
> | >       ll := [k for k in l | transcendental?(k)] where
> | >          transcendental?(k:K):Boolean ==
> | >             is?(k, "log"::SY) => true
> | >             is?(k, "exp"::SY) => true
> | >             is?(k, "tan"::SY) => true
> | >             is?(k, "atan"::SY) => true
> | >             false
> | >       ll
> | >
> |
> | This gives me the same error.
>
> Very interesting -- it worked for me.  Presumably, the other one works
> for Ralf.

No. Sorry for the misunderstanding. What I wanted to say was that both
forms should work. I simply assumed it should work as in Aldor. But as I
said in my last mail, there seems to be an error with the types...

Ralf

Aldor-Example...

>aldor -grun -laldor aaa.as
[2,3,5,3,5,7]
[2,3,5,3,5,7]

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

foo(l: List Integer): List Integer == {
        baz?(i: Integer): Boolean == member?(i, [2,3,5,7,11]);
        [i for i in l | baz? i];
}

bar(l: List Integer): List Integer == [i for i in l | baz? i] where
        baz?(i: Integer): Boolean == member?(i,  [2,3,5,7,11]);

main(): () == {
        import from Integer;
        l: List Integer := [1,2,3,4,5,1,3,5,7];
        stdout << foo l << newline;
        stdout << bar l << newline;
}
main();
---END aaa.as





reply via email to

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