Re: Function as an argument of the function
- To: mathgroup at smc.vnet.net
- Subject: [mg34648] Re: Function as an argument of the function
- From: "Allan Hayes" <hay at haystack.demon.co.uk>
- Date: Fri, 31 May 2002 04:26:24 -0400 (EDT)
- References: <ad4jg1$jm2$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Tomek,
Here is a way of restricting the acceptable inputs to expression of the form
g[x] - I have used a list as output, but you could combine things any way
you want.
f[x_, fn:_[_],y_]:= {x,fn,y}
f[1,2,3]
f[1,2,3]
f[1,2[4],3]
{1,2[4],3}
f[1,2[4,5],3]
f[1,2[4,5],3]
--
Allan
---------------------
Allan Hayes
Mathematica Training and Consulting
Leicester UK
www.haystack.demon.co.uk
hay at haystack.demon.co.uk
Voice: +44 (0)116 271 4198
Fax: +44 (0)870 164 0565
"Tomek" <maltomek at hotmail.com> wrote in message
news:ad4jg1$jm2$1 at smc.vnet.net...
> Hi.
> I have to write a short function in Mathematica. But I have one
> problem with it. One of arguments of my function have to be a
> function of one variable.
> How can I check if the argument of the function is a function of one
> variable (I wish there's FunctionQ)?
>