Re: Re: bug in Partition?

*To*: mathgroup at smc.vnet.net*Subject*: [mg65774] Re: [mg65693] Re: [mg65679] bug in Partition?*From*: Andrzej Kozlowski <akoz at mimuw.edu.pl>*Date*: Mon, 17 Apr 2006 02:28:13 -0400 (EDT)*References*: <200604140832.EAA22075@smc.vnet.net> <200604160544.BAA07903@smc.vnet.net>*Sender*: owner-wri-mathgroup at wolfram.com

On 16 Apr 2006, at 14:44, Carl K. Woll wrote: > Chris Chiasson wrote: >> Partition[Range[11], 3, 3, {1, 1}, Hold[]] >> >> the output is >> >> {{1, 2, 3}, {4, 5, 6}, {7, 8, 9}, {10, 11}} >> >> I would expect >> >> {{1, 2, 3}, {4, 5, 6}, {7, 8, 9}, {10, 11, Hold[]}} >> >> Might this be because of a ReleaseHold somewhere in the >> implementation >> of Partition? >> >> (Ver 5.2, Windows) > > Actually, the fifth argument should be a symbol or a list of stuff. > > Basically, the symbol case is converted to list form: > > Partition[_,_,_,_,symbol] > > is converted to > > Partition[_,_,_,_,{symbol}] > > It turns out that some additional generality was incorporated so that > the head of the 5th argument doesn't need to be List. So, your > sample input > > Partition[Range[11], 3, 3, {1, 1}, Hold[]] > > was actually interpreted as > > Partition[Range[11], 3, 3, {1, 1}, {} > > and no padding was done. This is not quite true. Actually padding was done, but using Sequence [], with the effect that it looks as if "no padding was done", see: Partition[Range[11], 3, 3, {1, 1}, {}]//Trace Looking at this (in the case of the original example with Hold[]) made me believe that ReleaseHold was used, although, now I think that if were the case it an explicit ReleaseHold would be visible in Trace. Anyway, now we know the truth and the only question remains: why would anyone at WRI make thigs work in this way and not let anyone know about it? Andrzej Kozlowski Tokyo, Japan > To get your desired input, use > > Partition[Range[11], 3, 3, {1, 1}, {Hold[]}] > > Note that because the head is immaterial, the following input will > generate the same output: > > Partition[Range[11], 3, 3, {1, 1}, foo[Hold[]]] > > Carl Woll > Wolfram Research >

**References**:**bug in Partition?***From:*"Chris Chiasson" <chris.chiasson@gmail.com>

**Re: bug in Partition?***From:*"Carl K. Woll" <carlw@wolfram.com>