Hello, Can I have in a package a function which define an other function from its own parameters ? Why ?
--------------------------------------------------------------------------- I continue to search pretty expand, combine and rewrite functions over expressions. I have already defined a function expandONElevel for the main level of an expression. It's possible to write a recursive map over Expressions But how can I utilize it for a recursive map ? I want to compile, but I can't : expand (x, MainParameters) == fct1 y == expandONElevel (y, FromMainParameters) expandONElevel (recursiveMap (x, fct1)) --------------------------------------------------------------------------- I can compile a such example but I get internal error when I test it. I can't write the fct1 function outside the expand function because I need data from mainParameters. Here is a minimal? package. I compile it with a warning : ; (DEFUN |ESS,mapRec;fct2| ...) is being compiled. ;; The variable |fct| is undefined. ;; The compiler will assume this variable is a global. ------------------------------------------------------------------------ In the interpreter I add df (x : Expression Integer) : Expression Integer == 2*x mapRecA... mapRecE are right, but I can't use mapRec. this test fails : mapRec (sin (3*x)+12*cos(5*exp (y)), df) Internal Error The function mapRec with signature hashcode is missing from domain EssaiMapRec(Integer)(Expression (Integer)) ------------------------------------------------------------------- )abbrev package ESS EssaiMapRec EssaiMapRec (R, F): Exports == Implementation where R : Join(OrderedSet, GcdDomain) F : Join(FunctionSpace R, TranscendentalFunctionCategory) K ==> Kernel F P ==> SparseMultivariatePolynomial (R, K) Exports ==> with mapRecA : F -> F mapRecB : F -> F mapRecC : F -> F mapRecD : F -> F mapRecE : F -> F mapRec : (F, F-> F) -> F Implementation ==> add import PolynomialCategoryLifting (IndexedExponents K, K, R, P, F) fctB : K -> F fctC : K -> F fctD : K -> F fctE : K -> F mapRecA x == map (#1::F, #1::F, numer x) / map (#1::F, #1::F, denom x) mapRecB x == map (fctB, #1::F, numer x) / map (fctB, #1::F, denom x) fctB k == sin (2::Integer::R::F) mapRecC x == map (fctC, #1::F, numer x) / map (fctC, #1::F, denom x) fctC k == nullary? (op := operator k) => k::F arg := first argument k (sin (arg))::F mapRecD x == map (fctD, #1::F, numer x) / map (fctD, #1::F, denom x) fctD k == nullary? (op := operator k) => k::F arg := first argument k (sin (mapRecD arg))::F mapRecE x == map (fctE, #1::F, numer x) / map (fctE, #1::F, denom x) fctE k == 2::R::F * k::F mapRec (x, fct) == fct2 (y:K):F == fct (y::F) -- fct2 (y:K):F == x * fct (y::F) map (fct2, #1::F, numer x) / map (fct2, #1::F, numer x) _______________________________________________ Axiom-developer mailing list Axiom-developer@nongnu.org http://lists.nongnu.org/mailman/listinfo/axiom-developer