help: outputing a function depending on a function parameter



Maybe you need to use buildq. Something like:

(%i1) makeDegreeCompatible(order) ::= buildq([order],
   lambda([x,y],
      (sum(x[i],i,1,length(x))<sum(y[i],i,1,length(y))) or
      (sum(x[i],i,1,length(x))=sum(y[i],i,1,length(y))) and
      order(x,y)))$
(%i2) f : makeDegreeCompatible(lambda([p,q], is(p[1] > q[1])));
(%o2) lambda([x,y],sum(x[i],i,1,length(x))<sum(y[i],i,1,length(y)) or 
sum(x[i],i,1,length(x))=
sum(y[i],i,1,length(y)) and lambda([p,q],is(p[1]>q[1]))(x,y))
(%i3) f([1,2,3],[4,5,6]);
(%o3) true

Barton

maxima-bounces at math.utexas.edu wrote on 09/26/2006 08:35:43 AM:

> Hi
> 
> I am trying to write a function that takes an ordering on sequences
> as a parameter and output the corresponding (total) degree
> compatible ordering.
> So, the output should be again a boolean function.
> I thought that one way to do it could be through 
> lambda expressions but what I do is wrong.
> 
> I would like to do something like:
> makeDegreeCompatible : /* or makeDegreeCompatible(order) := ... */
>   lambda([order],
>     lambda([x,y],
>       (sum(x[i],i,1,length(x))<sum(y[i],i,1,length(y))) or
>       (sum(x[i],i,1,length(x))=sum(y[i],i,1,length(y))) and
>       order(x,y))
>     );
> 
> but it does not work because the parameter order is within
> a lambda expression and it is not substituted with the
> value passed as a parameter.
> 
> Could someone please help me?
> 
>   Fabrizio
> 
> 
> _______________________________________________
> Maxima mailing list
> Maxima at math.utexas.edu
> http://www.math.utexas.edu/mailman/listinfo/maxima