Wolfram Function Repository
Instant-use add-on functions for the Wolfram Language
Function Repository Resource:
Create an association whose values are all a constant
ResourceFunction["ConstantAssociation"][keys,value] creates an Association whose keys are keys and whose values are all value. | |
ResourceFunction["ConstantAssociation"][value] is an operator form of ResourceFunction["ConstantAssociation"]. |
Create an association with two keys and whose values are all 0:
| In[1]:= |
| Out[1]= |
Create an association whose values are all Missing[]:
| In[2]:= |
| Out[2]= |
The operator form of ConstantAssociation:
| In[3]:= |
| In[4]:= |
| Out[4]= |
The constant value can be any Wolfram Language expression:
| In[5]:= |
| Out[5]= | ![]() |
Use the resource function JoinRest with ConstantAssociation to create default values for an Association that is missing certain key-value pairs:
| In[6]:= |
| Out[6]= |
Use the resource function JoinMost with ConstantAssociation to override values for certain keys in an association:
| In[7]:= |
| Out[7]= |
Store and use an operator that will assign Missing[] as the value to a list of keys:
| In[8]:= |
| In[9]:= |
| Out[9]= |
Use ConstantAssociation in conjunction with the resource function JoinRest to convert a ragged list of associations into a regular one:
| In[10]:= | ![]() |
| Out[10]= |
Tally the frequency of the characters "a" through "j" in a list that is missing many of those characters:
| In[11]:= |
| Out[11]= |
This work is licensed under a Creative Commons Attribution 4.0 International License