[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Axiom-developer] Nested functions in SPAD
From: |
Gabriel Dos Reis |
Subject: |
Re: [Axiom-developer] Nested functions in SPAD |
Date: |
07 Oct 2006 11:58:09 +0200 |
Waldek Hebisch <address@hidden> writes:
| How to correctly define nested function in algebra file? I changed
| beggining of goodCoef (in efstruc.spad.pamphlet) to the following:
|
| 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
| 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 := [k for k in l | transcendental?(k)]
|
| that compiles OK, but at runtime I get:
|
| >> System error:
| The function |EFSTRUC;transcendental?| is undefined.
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
-- Gaby