Basic Examples (7)
An Association in which keys and values are stored without evaluation:
Extract the value associated with key 1+1:
Convert a List of rules to an Association:
Create an unevaluated Association from an uninitialized Association:
Specify that a key should be evaluated:
Specify that a value should be evaluated:
Many operations can be done while preserving the original expressions:
Append an element without evaluation:
Scope (6)
UnevaluatedAssociation can be used to join associations with new associations/values:
Use the three-argument form of Extract to get values without evaluating them:
Nested associations are not initialized:
Use Evaluate to force them to initialize:
Nested uses of UnevaluatedAssociation for values are automatically initialized:
Using RuleDelayed will prevent this initialization:
Get Values without evaluating them by using Map and Hold:
Get Keys without evaluating them by using KeyMap and Hold:
Options (3)
AlwaysReturnAssociation (3)
By default, in cases where a valid Association cannot be constructed, UnevaluatedAssociation does not return an Association:
Specify that UnevaluatedAssociation should always return an Association, even if it is not AssociationQ:
Restore the default behavior:
Properties and Relations (5)
UnevaluatedAssociation creates an Association object:
Values extracts and evaluates values:
Keys extracts and evaluates keys:
Normal turns an Association into a List of rules, which will evaluate keys and values:
The values associated with keys can be changed:
This will change the Rule to a RuleDelayed, however:
An empty UnevaluatedAssociation is the same as an empty Association:
Possible Issues (3)
Replacing the head of an Association loses keys:
Some operations will evaluate both the keys and values:
Options cannot be passed to UnevaluatedAssociation as arguments, since they will be interpreted as key-value pairs:
Use SetOptions instead: