ecl-logo Documentation

KeyPatternsQ

KeyPatternsQ[data,patterns]result

does a key-wise MatchQ comparison of the keys in data with the patterns specified by the keys in patterns.

Details

  • When Verbose->True, the output is an Association with the results of each of the comparisons.
  • You can check if something is missing with the form <|key->_Missing|>
  • Input
    Output
    General Options

Examples

Basic Examples  (5)

Check values of first param match the patterns in the second param:

Only checks the values passed into the second Association:

Fails if key in first Association is Missing:

Can check is something is not there by checking the _Missing pattern:

Works on lists of rules:

Additional Examples  (1)

Works checking a single key with a Rule for the second param:

Options  (2)

Verbose  (2)

Verbose->True returns an Assocation with details on what's wrong:

Verbose->True returns all True assocation: