Function Repository Resource:

# JoinRest

An operator that performs a Join of its argument with the sequence of lists it is provided

Contributed by: Seth J. Chandler
 ResourceFunction["JoinRest"][list] gives an operator that will join list with the sequence of lists it is given.

## Details and Options

When used in conjunction with associations, ResourceFunction["JoinRest"] can be thought of as creating an association of key-value pairs kv that will augment the output association if and only if the Join of whatever arguments the operator encounters fail to otherwise contain a key-value pair with a key of k.
The argument need not have head List. All subsequent expressions will be joined to it, provided they have the same head.

## Examples

### Basic Examples

JoinRest uses Join to join its argument {3,4} with whatever else it encounters, which you may think of as the “Rest” of the Join:

 In[1]:=
 Out[1]=

JoinRest applied to an association creates an operator that will add key-value pairs to the Join of the argument it is passed, but only if those joined associations fail to contain a key present in the association to which JoinRest was applied:

 In[2]:=
 Out[2]=

### Scope

The operator created by JoinRest using an Association can accept a sequence of associations:

 In[3]:=
 Out[3]=

If JoinRest has no argument, it operates as an identity on the data it is given:

 In[4]:=
 Out[4]=

If JoinRest has a sequence of associations as its argument, it will use the last value for any key it encounters in that sequence as a basis for adding key-value pairs:

 In[5]:=
 Out[5]=

### Applications

JoinRest can be right-composed with Counts to create an Association that obtains the number of every anticipated value in an expression:

 In[6]:=
 Out[6]=

### Properties and Relations

JoinRest works similarly to Merge with a First combiner function:

 In[7]:=
 Out[7]=

JoinRest is very similar to the resource function JoinMost. In JoinRest its argument is placed first in the Join; in JoinMost its argument is placed last in the Join.

### Possible Issues

JoinRest, like Join, will fail to evaluate if the heads of the expressions to be joined differ from one another:

 In[8]:=
 Out[8]=

### Neat Examples

Insert JoinRest into a pipeline of operators created by Query, such that the count of various categories that survived and died on the Titanic defaults to 0:

 In[9]:=
 In[10]:=
 Out[10]=