ecl-logo Documentation

AssociationMatchQ

AssociationMatchQ[testAssociation,patternAssociation]boolean

compares the key-value pairs in testAssociation to the keys and patterns in patternAssociation and returns True if each key-value matches the pattern specified in the patternAssociation.

Details

    Input
    Output
    General Options

Examples

Basic Examples  (3)

Compares the values of test association with pattern association:

Returns False if patterns do not match:

Returns False if key is missing:

Additional Examples  (1)

KeyValuePattern will allow foreign keys in the test association whereas AssociationMatchQ by default does not:

Options  (2)

AllowForeignKeys  (1)

Toggle allowing the input association to have keys that do not exist in the pattern association:

RequireAllKeys  (1)

Toggle allowing the input association to not include keys that exist in the pattern association: