Setting Attributes for Function Generated Parameters (with package

*To*: mathgroup at smc.vnet.net*Subject*: [mg110274] Setting Attributes for Function Generated Parameters (with package*From*: telefunkenvf14 <rgorka at gmail.com>*Date*: Fri, 11 Jun 2010 02:09:53 -0400 (EDT)

Group: My goal is to generate a list of symbolic parameters that other functions in a package can Map[] over. For sake of example, suppose I define the following 'utility' function as part of a larger package. In[1]:= ClearAll["Global`*"] In[2]:= shares[n_?IntegerQ/;n>0,s_Symbol: s]:=Module[{i},Table[Symbol[ToString[s]<>ToString[i]],{i,n}]] In[3]:= shares[2] Out[3]= {s1,s2} I would now like to include the attribute Constant to each of the s1, ..., sn generated. What is the best way to do this? My gut tells me that ideally I'd want to do this inside the shares[] function itself, but I couldn't figure out how. The workaround I've been toying with is to define another utility function: In[4]:= setConstants[vars_]:=SetAttributes[#,Constant]&@vars This seems to work ok...But does anyone see potential pitfalls with this approach? In[5]:= setConstants[shares[2]] In[6]:= Attributes[s1] In[7]:= Attributes[s2] Out[6]= {Constant} Out[7]= {Constant} -RG