Wolfram Function Repository
Instant-use add-on functions for the Wolfram Language
Function Repository Resource:
An operator that performs a Join of its argument with the sequence of lists it is provided
ResourceFunction["JoinRest"][list] gives an operator that will join list with the sequence of lists it is given. |
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]= | ![]() |
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]= | ![]() |
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]= | ![]() |
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.
JoinRest, like Join, will fail to evaluate if the heads of the expressions to be joined differ from one another:
In[8]:= | ![]() |
Out[8]= | ![]() |
Insert JoinRest to 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]= | ![]() |
This work is licensed under a Creative Commons Attribution 4.0 International License