Re: apply rule to Partition

*To*: mathgroup at smc.vnet.net*Subject*: [mg131694] Re: apply rule to Partition*From*: Tomas Garza <tgarza10 at msn.com>*Date*: Sat, 21 Sep 2013 04:38:10 -0400 (EDT)*Delivered-to*: l-mathgroup@mail-archive0.wolfram.com*Delivered-to*: l-mathgroup@wolfram.com*Delivered-to*: mathgroup-outx@smc.vnet.net*Delivered-to*: mathgroup-newsendx@smc.vnet.net*References*: <20130920110657.874FE69E8@smc.vnet.net>

The error message doesn't prevent the evaluation from taking place. In this case it acts more as a warning. You may eliminate this warning using Quiet: In[1]:= Partition[Range[10],m]/.m->3//QuietOut[2]= {{1,2,3},{4,5,6},{7,8,9}} Alternatively you can write the ReplaceAll inside the brackets: In[3]:= Partition[Range[10],m/.m->3]Out[3]= {{1,2,3},{4,5,6},{7,8,9}} or you can use With: In[5]:= With[{m=3},Partition[Range[10],m]]Out[5]= {{1,2,3},{4,5,6},{7,8,9}} In all cases, m has to be a positive integer; otherwise the error actually prevents the evaluation. The definition of Partition doesn't make this explicit but I guess it goes without saying. -Tomas > From: jougraw at gmail.com > Subject: apply rule to Partition > To: mathgroup at smc.vnet.net > Date: Fri, 20 Sep 2013 07:06:57 -0400 > > > I want to use rule to simplify my code. A piece of my code use Partition > and I tried something like: > > Partition[Range[10], m] /. m -> 2 > > It give me error message. My real code is in fact more complicated and this > way failed to give me an output. How could I make it work? > Thanks. > >

**References**:**apply rule to Partition***From:*Joug Raw <jougraw@gmail.com>