ecl-logo Documentation

AssociationMatchP

AssociationMatchP[patternAssociation]pattern

generates pattern that matches an association with key-value patterns that match the patterns specified in patternAssociation.

Details

    Input
    Output
    General Options

Examples

Basic Examples  (3)

Used as for pattern matching associations:

Takes in pattern association and builds pattern using AssociationMatchQ:

Returns False if patterns do not match:

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: