Re: Function as an argument

*To*: mathgroup at smc.vnet.net*Subject*: [mg76695] Re: [mg76625] Function as an argument*From*: Bob Hanlon <hanlonr at cox.net>*Date*: Sat, 26 May 2007 04:23:33 -0400 (EDT)*Reply-to*: hanlonr at cox.net

ss[x_] = 2 + x^3; MyFunction[expression_] := expression[2]; MyFunction[ss] 10 The argument must be a function MyFunction[2 + #^3 &] 10 Bob Hanlon ---- dXdYdZdu <dxdydzdu at gmail.com> wrote: > Hi, I have problem. I want to do something like this: > > ss[x_] = 2 + x^3 ; > MyFunction[expression_] := Module[{}, Return[expression[2]]] > Calling MyFunction[ss] will produce 10 and this is working case. > > but this is what I can not do: > > MyFunction[2 + x^3] > > Is there a way to make this to work as well? >