Message Boards Message Boards

1
|
1679 Views
|
0 Replies
|
1 Total Likes
View groups...
Share
Share this post:

A pretty general pattern matching test program

Posted 2 years ago

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: enter image description here

Attachments:
POSTED BY: Werner Geiger
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract