[Date Index] [Thread Index] [Author Index]
Re: Function as an argument to a function
myFunction[expr_, sym_Symbol:x, param_:1] := expr /. sym -> param myFunction[f[x]] f myFunction[f[y], y, z] f[z] myFunction[Exp[x]] E myFunction[y^2+3y+7, y] 11 myFunction[y^2+3y+7, y, 2] 17 Bob Hanlon In a message dated 8/28/98 8:25:30 AM, jlakkako at jade.hut.fi wrote: >I want to pass a function as an argument to a function I am developing. >For example: Myfunction[Exp[x]] > >I would like Myfunction to return the value of it's parameter function >when (for example) x=1. > >Here's what I have tried: > >Myfunction[f_] := > f > >Doesn't work. Any suggestions??