Deflatten the keys in a flat Association to create a nested Association
Contributed by:
Richard Hennigan (Wolfram Research)
Examples
Basic Examples (4)
Create a nested Association from a flat Association with lists as keys:
Keys not wrapped in a list are unchanged:
Provide a function to interpret keys as lists:
Values held by RuleDelayed will not be evaluated:
Scope (1)
AssociationKeyDeflatten also works with lists of rules:
Properties and Relations (2)
Deflatten the keys of an Association:
Use AssociationKeyFlatten to get the original Association:
If f and g are partial inverses of each other, AssociationKeyDeflatten[…,f] and AssociationKeyFlatten[…,g] typically will be as well:
Neat Examples (3)
Convert an Association where keys are file paths into a nested Association:
Get everything under a particular directory:
Revert to the flat Association:
Version History
-
1.0.1
– 12 November 2024
-
1.0.0
– 30 September 2020
Related Resources