Re: A bug in Partition?
- To: mathgroup at smc.vnet.net
 - Subject: [mg117466] Re: A bug in Partition?
 - From: Heike Gramberg <heike.gramberg at gmail.com>
 - Date: Sat, 19 Mar 2011 05:20:40 -0500 (EST)
 
On 18 Mar 2011, at 10:58, Alexey wrote:
> ----- Original Message -----
> From: "Bill Rowe" <readnews at sbcglobal.net>
>> Perhaps you want to pad at both ends so that nothing gets
>> dropped.
> 
> I just want to pad at the start the same way as Partition does it at
> the end (as I understand in this case nothing gets dropped). Is it
> possible with Partition?
> 
what about 
part[list_, n_] := Partition[list, n, n, Mod[-Length[list], n] + 1, 0]
In[36]:= part[Range[18], 7]
Out[36]= {{0, 0, 0, 1, 2, 3, 4}, {5, 6, 7, 8, 9, 10, 11}, {12, 13, 
  14, 15, 16, 17, 18}}
Heike.