MathGroup Archive 1998

[Date Index] [Thread Index] [Author Index]

Search the Archive

expressions as arguments to functions.



I forgot the magic combination of Hold, Release and Evaluate to get a
user defined function to accept expressions as arguments like most
built-in functions do.  For example:

I want to define

testfunction[f_,a_]:=f[a]

and have testfunction[x^2,3] return 9 rather than x^2[3].



Can someone remind me how to do it.  If you wouldn't mind, explain to me
why it works.  I still don't understand all the holds and evaluations
of arguments.  Note that I don't want to have to enter in a pure
function construct as an argument.



  • Prev by Date: About plotting a surface
  • Next by Date: Return inside Do, For and While
  • Prev by thread: Re: About plotting a surface
  • Next by thread: Re: expressions as arguments to functions.