Re: Passing options through user-defined functions

*To*: mathgroup at smc.vnet.net*Subject*: [mg59000] Re: [mg58967] Passing options through user-defined functions*From*: Pratik Desai <pdesai1 at umbc.edu>*Date*: Tue, 26 Jul 2005 04:02:42 -0400 (EDT)*References*: <200507250530.BAA05222@smc.vnet.net>*Sender*: owner-wri-mathgroup at wolfram.com

Joe Christy wrote: >I have a function implemnted as module which uses various builtin >functions. What is the best way to pass options to the builtin functions? > >For example, I have something like > >foo[p,q]:= >Module[ > {bar}, > bar=Table[ > f[x,y], > {x,1,p},{y,1,q} > ]; > ArrayPlot[bar] >] > >and I would like to be able to write something like > >foo[3,5, size -> 100] > >and see the results of ArrayPlot[bar, ImageSize->{3*100,5*100}] > > Will this be acceptable? foo[p_?IntegerQ,q_?IntegerQ,size]:= Module[{bar,r1=p,r2=q,r3=size},bar=Table[x^2+y^2,{x,1,r1},{y,1,r2}]; ArrayPlot[bar,ImageSize\[Rule]{r1*size,r2*size}]] Pratik -- Pratik Desai Graduate Student UMBC Department of Mechanical Engineering Phone: 410 455 8134

**References**:**Passing options through user-defined functions***From:*Joe Christy <joe@eshu.net>