# \[?\] Understand sequence behaviour?

**URL:** <https://community.wolfram.com/t/understand-sequence-behaviour/10189>\
**Category:** Questions\
**Created:** [March 21, 2017, 9:47am UTC](https://community.wolfram.com/t/understand-sequence-behaviour/10189 "2017-03-21T09:47:14Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![danielhuber](https://avatars.discourse-cdn.com/v4/letter/d/e5b9ba/32.png) [@danielhuber](https://community.wolfram.com/u/danielhuber)\
**Post date:** [March 21, 2017, 9:47am UTC](https://community.wolfram.com/t/understand-sequence-behaviour/10189/1 "2017-03-21T09:47:14Z")

</div>

Mathematica 11.0.1.0, Windows 64 bit

Can somebody explain why in the first example “Sequence” behaves as expected, whereas in the second we have an error:

First example:

```
m = {{1, 2}, {3, 4}};
m[[All, 2]] = Sequence[];
mm[[2]] = Sequence[];

```

Second example:

```
m = {{1, 2}, {3, 4}};
m[[2]] = Sequence[];
m[[All, 2]] = Sequence[];

```

---

<div class="post-metadata">

**Author:** ![sghuisman](https://yyz1.discourse-cdn.com/wolfram/user_avatar/community.wolfram.com/sghuisman/32/27850_2.png) [@sghuisman](https://community.wolfram.com/u/sghuisman)\
**Post date:** [March 21, 2017, 10:55am UTC](https://community.wolfram.com/t/understand-sequence-behaviour/10189/2 "2017-03-21T10:55:06Z")

</div>

Strange indeed! However,

```
m = {{1, 2}, {3, 4}, {5, 6}};
m
m[[2]] = Sequence[];
m = m
m[[All, 2]] = Sequence[];
m

```

does work! It think it is due to that m is stored like:

```
{{1,2},Sequence[]}

```

Such that there is no second element in the second element. by doing m = m you ‘evaluate’ the Sequence. Might be the intended behavior or not, I almost never use Sequence in this way…

I would suggest using **Drop** , which is intended to remove elements, columns, rows, et cetera…

---

<div class="post-metadata">

**Author:** ![danl](https://yyz1.discourse-cdn.com/wolfram/user_avatar/community.wolfram.com/danl/32/41267_2.png) [@danl](https://community.wolfram.com/u/danl)\
**Post date:** [March 21, 2017, 3:33pm UTC](https://community.wolfram.com/t/understand-sequence-behaviour/10189/3 "2017-03-21T15:33:58Z")

</div>

It is an artifact of how `Sequence` is implemented.

```
m = {{1, 2}, {3, 4}};                                                      
m[[2]] = Sequence[];                                                       

In[12]:= ??m                                                                        
(*Global`m

m = {{1, 2}, Sequence[]} *)

```

Resetting `m` (e.g. `m=m` as @Sander showed)forces the `Sequence[]` to disappear.

---

<div class="post-metadata">

**Author:** ![sghuisman](https://yyz1.discourse-cdn.com/wolfram/user_avatar/community.wolfram.com/sghuisman/32/27850_2.png) [@sghuisman](https://community.wolfram.com/u/sghuisman)\
**Post date:** [March 21, 2017, 4:49pm UTC](https://community.wolfram.com/t/understand-sequence-behaviour/10189/4 "2017-03-21T16:49:48Z")

</div>

I was trying to show this using **Hold** ( **All** )( **Complete** ), **SequenceHold** or **HoldForm** et cetera, but couldn’t… didn’t think of using **Definition** …

---

<div class="post-metadata">

**Author:** ![kubapod](https://yyz1.discourse-cdn.com/wolfram/user_avatar/community.wolfram.com/kubapod/32/18662_2.png) [@kubapod](https://community.wolfram.com/u/kubapod)\
**Post date:** [March 21, 2017, 8:33pm UTC](https://community.wolfram.com/t/understand-sequence-behaviour/10189/5 "2017-03-21T20:33:21Z")

</div>

Here is an extended discussion:

- [Using Sequence to delete a part of an expression](http://mathematica.stackexchange.com/q/118108/5478)

---

<div class="post-metadata">

**Author:** ![kubapod](https://yyz1.discourse-cdn.com/wolfram/user_avatar/community.wolfram.com/kubapod/32/18662_2.png) [@kubapod](https://community.wolfram.com/u/kubapod)\
**Post date:** [March 21, 2017, 8:34pm UTC](https://community.wolfram.com/t/understand-sequence-behaviour/10189/6 "2017-03-21T20:34:31Z")

</div>

FYI, `OwnValues[m]` would do too.

---

<div class="post-metadata">

**Author:** ![henrikschachner](https://yyz1.discourse-cdn.com/wolfram/user_avatar/community.wolfram.com/henrikschachner/32/32119_2.png) [@henrikschachner](https://community.wolfram.com/u/henrikschachner)\
**Post date:** [March 21, 2017, 10:29pm UTC](https://community.wolfram.com/t/understand-sequence-behaviour/10189/7 "2017-03-21T22:29:54Z")

</div>

Interesting! So `Sequence[]` is basically equivalent to `Nothing` ?!?

---

<div class="post-metadata">

**Author:** ![kubapod](https://yyz1.discourse-cdn.com/wolfram/user_avatar/community.wolfram.com/kubapod/32/18662_2.png) [@kubapod](https://community.wolfram.com/u/kubapod)\
**Post date:** [March 22, 2017, 6:26am UTC](https://community.wolfram.com/t/understand-sequence-behaviour/10189/8 "2017-03-22T06:26:30Z")

</div>

notHere[Sequence, Nothing]

Nothing only vanishes from Lists and is not affected by e.g. SequenceHold.
