MathGroup Archive 2011

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: A bug in Partition?

  • To: mathgroup at
  • Subject: [mg117401] Re: A bug in Partition?
  • From: Bill Rowe <readnews at>
  • Date: Thu, 17 Mar 2011 06:32:53 -0500 (EST)

On 3/16/11 at 6:30 AM, lehin.p at (Alexey) wrote:

>Consider the following:


>One can see that in the first case element 'i' is dropped! Why this
>happens? Is this intended behavior?

Yes, this is the way Partition is supposed to work.

By doing


you are saying:
pad only at the beginning
pad using n-1 x with the first element of list in the nth
position of the first group
take the next set of n elements for the next group
continue as long as you can take n more elements
stop once you cannot get n elements

By doing


you pad at the end with enough x's to make the flattened length
a multiple of n.

Perhaps you want to pad at both ends so that nothing gets
dropped. If so, do


keep in mind Partition[list,n,n,k] is simply shorthand for Partition[list,n,n,{k,k}]

  • Prev by Date: Re: Joining points of ListPlot
  • Next by Date: Re: Wolfram, meet Stefan and Boltzmann
  • Previous by thread: Re: A bug in Partition?
  • Next by thread: Re: A bug in Partition?