Re: part assigned sequence behavior puzzling

• To: mathgroup at smc.vnet.net
• Subject: [mg105274] Re: part assigned sequence behavior puzzling
• From: dh <dh at metrohm.com>
• Date: Wed, 25 Nov 2009 23:01:51 -0500 (EST)
• References: <heimgd\$58a\$1@smc.vnet.net>

```
mkr wrote:

> I am puzzled by the following behavior:

>

> tmp = Range[15]

> tmp[[7]] = Sequence @@ Range[2];

> tmp[[7]] = Sequence @@ Range[2];

> tmp[[7]] = Sequence @@ Range[2];

> tmp

>

> yields

>

> {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15}

> {1, 2, 3, 4, 5, 6, 1, 2, 8, 9, 10, 11, 12, 13, 14, 15}

>

> I would have expected the repeated assignment to have a repeated

> effect, thus obtaining

>

> {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15}

> {1, 2, 3, 4, 5, 6, 1, 2, 2, 2, 8, 9, 10, 11, 12, 13, 14, 15}

>

> Where/why am I wrong?

>

Hi,

I asked the same question some time ago.

Set(=) has the attribute SequenceHold and does NOT evaluate Sequence.

What is assigne to tmp[[7]] is simply Sequence[1,2]. You can convince

yourselfe by: ??tmp

Only when you e.g.  display tmp, Sequence will be evaluated.

Daniel

```

• Prev by Date: Mathematica Sorting Anti-Stable?
• Next by Date: Solve how to eliminate variable
• Previous by thread: Re: part assigned sequence behavior puzzling
• Next by thread: Re: part assigned sequence behavior puzzling