matcher(expression,expression) → assignment
The subroutine matcher takes two expressions as arguments and checks whether the second (the expression) is an instance of the first (the pattern). If the pattern matches the expression, matcher returns the corresponding variable assignment; otherwise, it returns false.
Call: matcher(read('p(X,Y)'),read('p(a,b)'))
Exit: {X:a, Y:b}
Call: matcher(read('p(X,Y)'),read('p(a,a)'))
Exit: {X:a, Y:a}
Call: matcher(read('p(X,X)'),read('p(a,a)'))
Exit: {X:a}
Call: matcher(read('p(a,b)'),read('p(a,b)'))
Exit: {}
Call: matcher(read('p(X,X)'),read('p(a,b)'))
Exit: false
User: matcher(read('p(a,b)'),read('p(X,Y)'))
Exit: false
An expression is an instance of a pattern if and only of there is a variable assignment that, when applied to the pattern, produces an expression that is identical to the specified expression.
|