passing functions as argument one more time



1. try apply(f,[t]). I don't know why you are doing apply('f ...).

2. block ([...],local(h), ..h(x):= ....

3. defining functions within functions was not a popular way of writing 
lisp programs in 1968.
It still isn't, though with scheme and lexically scoped common lisp it 
is more plausible.
You seem to be straining to do something that can be done by this:

ff(f,x):= block([], local(h), h(x):= if x<1 then x else 3*x,   
apply(f,x)*h(2*x));



RJF


amli at comcast.net wrote:

>1.  How can I make sure that the functions defined in global space do not conflict with passing of 
>function arguments? For example I do not want f(x) defined outside the program  conflict with passing the function f.   (In a scipt file I may have many functions defined)
>
>
>x:5;
>t:3;
>ff(f,x):=block([t,g,h],g:apply('f,[t]),if x<1 then h(x):=x else h(x):=3*x,ev(g,t=x)*h(2*x));
>ff(sin,2);    //works
>
>
>f(x):=x^2;
>ff(f,x):=block([t,g,h],g:apply('f,[t]),if x<1 then h(x):=x else h(x):=3*x,ev(g,t=x)*h(2*x));
>ff(sin,2);  //does not work
>
>I tried this 
>(x):=x^2;
>ff(f,x):=block([t,g,h],g:'apply('f,[t]),if x<1 then h(x):=x else h(x):=3*x,ev(g,t=x)*h(2*x));
>ff(sin,2);  
>but how do you get the final evaluation.
>
>2.  I also do not want the functions defined inside the program such as h have global scope.  How can I restrict them to be local only.   I suppose I could use the kill command.  Is that the only solution?
>
>Thank you
>
>Ram
>_______________________________________________
>Maxima mailing list
>Maxima at math.utexas.edu
>http://www.math.utexas.edu/mailman/listinfo/maxima
>  
>