Function Repository Resource:

# AppendSequence

Append multiple items to an expression at once

Contributed by: Richard Hennigan (Wolfram Research)
 ResourceFunction["AppendSequence"][expr,elem1,elem2,…] gives expr with the elements elem1,elem2,… appended. ResourceFunction["AppendSequence"][elem] represents an operator form of ResourceFunction["AppendSequence"] that can be applied to an expression.

## Details and Options

In iteratively building a list, it is usually more efficient to use Sow and Reap than to use ResourceFunction["AppendSequence"][list,new1,new2,] at each step.
ResourceFunction["AppendSequence"] works on SparseArray objects, returning ordinary lists if necessary.
ResourceFunction["AppendSequence"] can be used on Association objects. Single new elements are specified in the form keyvalue. New values replace older ones if their keys are the same.
ResourceFunction["AppendSequence"][elem][expr] is equivalent to ResourceFunction["AppendSequence"][expr,elem].
ResourceFunction["AppendSequence"] has the attribute SequenceHold.
In ResourceFunction["AppendSequence"][h[],e1,e2,], if h has the SequenceHold attribute, the e1, e2, are appended as a single Sequence object in the output, yielding h[,Sequence[e1,e2,]].

## Examples

### Basic Examples

 In[1]:=
 Out[1]=

Append to an Association:

 In[2]:=
 Out[2]=

Append to a SparseArray:

 In[3]:=
 Out[3]=
 In[4]:=
 Out[4]=

View the corresponding list:

 In[5]:=
 Out[5]=

Use the operator form:

 In[6]:=
 Out[6]=
 In[7]:=
 Out[7]=

Use a head other than List:

 In[8]:=
 Out[8]=

Append elements without evaluating them:

 In[9]:=
 Out[9]=

### Applications

Append multiple options to a Notebook:

 In[10]:=
 Out[10]=
 In[11]:=
 Out[11]=

Successively append to a list:

 In[12]:=
 Out[12]=

### Possible Issues

Using AppendSequence with heads that have the attribute SequenceHold will append a Sequence:

 In[13]:=
 Out[13]=

The operator form only takes a single argument:

 In[14]:=
 Out[14]=

Wrap multiple arguments with Sequence to use in the operator form:

 In[15]:=
 Out[15]=

## Requirements

Wolfram Language 11.3 (March 2018) or above