Created
November 20, 2016 12:30
-
-
Save anchetaWern/b289d26efd5445a390ced980389a08c4 to your computer and use it in GitHub Desktop.
prolog demo
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#fact source | |
male(goku). | |
female(chichi). | |
parent(goku, gohan). | |
parent(chichi, gohan). | |
parent_of(X, Y, Z) :- male(X), female(Y), parent(X, Z), parent(Y, Z). | |
#running the program | |
where: query -> result | |
male(goku). -> true | |
female(goku). -> false | |
parent(goku, gohan). -> true | |
parent(goku, chichi). -> false | |
parent(X, gohan). -> X = goku | |
parent_of(vegeta, bulma, trunks). -> false (although its true, its still considered false since its not in the fact source) | |
parent_of(X, Y, gohan). -> X = goku, Y = chichi | |
parent_of(goku, chichi, gohan). -> true |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment