Re: Q: extracting list of arguments of function
- To: mathgroup at smc.vnet.net
- Subject: [mg16517] Re: [mg16468] Q: extracting list of arguments of function
- From: BobHanlon at aol.com
- Date: Tue, 16 Mar 1999 03:59:59 -0500
- Sender: owner-wri-mathgroup at wolfram.com
In a message dated 3/13/99 11:48:40 AM, woland99 at earthlink.net writes: >Let's assume that we want to pass function goo as argument >to another function foo and extract list of arguments >of the function goo: >foo[fun_] := Module[{argList}, argList = Table[fun[[i]],{i,1,2}] ] >foo[goo[x,y]]; > >This will result in list: >{x,y} > >But if goo was defined before eg: >goo[s_,t_] = s^2 + t^3; > >then we get: >{x^2,y^3} ..... > >Can anybody point me in a right direction here? > If I understand what you want: foo[fun_[x__]] := {x}; foo[goo[x,y]] {x,y} goo[s_,t_] := s^2 + t^3; foo[goo[x,y]] {x,y} Bob Hanlon