EpilogJS
What
versus
How
 

unifyp


unifier(expression,expression) → assignment

The subroutine unifier takes two expressions as arguments and checks whether the two expressions can be unified. If so, unifier returns the variable assignment; otherwise, it returns false.

Call: unifier(read('p(X,Y)'),read('p(a,b)')) Exit: {X:a, Y:b} Call: unifier(read('p(X,Y)'),read('p(a,a)')) Exit: {X:a, Y:a} Call: unifier(read('p(X,X)'),read('p(a,a)')) Exit: {X:a} Call: unifier(read('p(a,b)'),read('p(a,b)')) Exit: {} Call: unifier(read('p(X,X)'),read('p(a,b)')) Exit: false User: unifier(read('p(a,b)'),read('p(X,Y)')) Exit: false

Two expressions can be unified if and only of there is a variable assignment that makes them look alike, i.e. the result of applying the variable assignment to the first expression is identical to the result of applying the variable assignment to the second expression.




Comments and complaints to genesereth@stanford.edu.