A pretty general pattern matching test program

This is a pretty general pattern matching test program. Within a Do-Loop It accepts a list do of lists; one list per pattern:

do = { {pattern, args, expMatches, description, trace, supp}, ...}.

This will define a function

f[xs:pattern] := doSomething[xs]

which will be called with different arguments xs given in args.

… See the attached Notebook “220406 Pattern Test.nb”…

As an example for an entry

{{_?(# \[Element] Reals && #[[1]] < #[[2]] &) ...}, {
    {{11, 12}, {\[Pi], 3}}, {{11, 12.}, {\[Pi], 3.2}}, {{11, 
    12.}, {\[Pi], \[Pi] + I}}
  }, 1, "List of Pairs of Reals with x < y, with PatternTest"}

in the Do - list it will produce this output:

220406 Pattern Test.nb (420 KB)

1 Like