
match - pattern matching

Calling sequence:
match(expr, mexpr)

Parameter:

expr, mexpr   --  expression

Summary:

match tests if mexpr can be matched with expr.  mexpr can consist of all
normal values which match only with the same values and match-variables
which can match different values depending on the concrete match-variable.
A value is recognized as match-variable if it is not of basic type and if its
domain contains an entry ``FREEVARIABLE``. The first operand of a match
variable is considered the name, which is used to identify the variable. The
second operand is considered a function which determines if a value can match
the match-variable. This function is called with the value, the match-variable
is supposed to match, a table, which associates the match-variables already
matched with their values and the match-variable itself as parameters.  If
the domain has a third operand the match variable is assumed to be able to
match a sequence of expressions. If the function returns MuPADTRUE the
match-variable can match the value, otherwise not. If expr and mexpr can be

matched the function returns a table which associates every match-variable
with the value used for the match.

>>  d:=domain:d::FREEVARIABLE:=TRUE:
    y:=new(d,"y",TRUE):z:=new(d,"x",TRUE,TRUE):
    match(a+2,z);
    match(a+b+2,z+2);
    match(a+b+2,y+2);
    match(a+2,z*2);

      table("x"=a + 2)
      table("x"=(a, b))
      FAIL
      table("x"=a)
      FAIL

