expressions as arguments to functions.
- To: mathgroup@smc.vnet.net
- Subject: [mg12559] expressions as arguments to functions.
- From: Sean Ross <seanross@worldnet.att.net>
- Date: Sat, 23 May 1998 18:11:20 -0400
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.