Re: bug in Partition?
- To: mathgroup at smc.vnet.net
- Subject: [mg65706] Re: [mg65679] bug in Partition?
- From: Andrzej Kozlowski <akoz at mimuw.edu.pl>
- Date: Sun, 16 Apr 2006 01:45:13 -0400 (EDT)
- References: <200604140832.EAA22075@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
On 14 Apr 2006, at 17:32, 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) > You are right that ReleaseHold is applied as you can see by looking at Trace (and noting that ReleaseHold[Hold[]] is Sequence[]) or just by inserting Hold[1] instead of Hold[]. But why do you think this is a bug? It actually gives you one more way of using Partition - padding with Hold[] is equivalent to using Sequence[] in the sublists.However, if you try use Sequence[] directly as the last argument to Partition it will vanish too soon and the result will be the same as if you had no last argument at all. I can't speak for WRI but I would tend to consider this as an "undocumented feature". There seem to be still quite a lot of this kind in Mathematica;-) Andrzej Kozlowski
- References:
- bug in Partition?
- From: "Chris Chiasson" <chris.chiasson@gmail.com>
- bug in Partition?