axiom-developer
[Top][All Lists]
Advanced

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

Re: [Axiom-developer] Can I define a function inside a function ?


From: Francois Maltey
Subject: Re: [Axiom-developer] Can I define a function inside a function ?
Date: 20 Nov 2006 21:22:10 +0100
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.4

Hello, again and thanks a lot for this good advice !

> Did you try
> 
>    expand (x, MainParameters) ==
>      expandONElevel(recursiveMap, x, ftc1) where
>         fct1 y == expandONElevel(y, FromMainParameters)

I can compile this function mapRec, but the compile rejects all tries
with fct or ftest (in the definition of the mapRec) in fct2.


    mapRec (x, fct, ftest) ==
      map (fct2, #1::F, numer x) / map (fct2, #1::F, denom x) 
       where 
        fct2 (y:K):F == 
          nullary? (op := operator y) => y::F
--          fct (first argument y)
--          L := [fct z for z in argument y]$List F
          op (argument y)
          ftest y => y::F
          y::F

And I can compile it : 
The variables are local inside the mapRec, they are not parameters.
It's like Maple ;-(

    mapRec (x, fct, ftest) ==
      fct1 := fct
      ftest1 := ftest 
      map (fct2, #1::F, numer x) / map (fct2, #1::F, denom x) 
       where 
        fct2 (y:K):F == 
          nullary? (op := operator y) => y::F
          ftest1 y =>  op (map (fct1, argument y))
          y::F

But I can't with     op [fct1 z for z in argument y]. 
I must type          op (map (fct1, argument y))

And I don't understand this last difference...




reply via email to

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