Created
October 14, 2011 21:30
-
-
Save japaz/1288415 to your computer and use it in GitHub Desktop.
7L7W Prolog - Day 1
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
% Make a simple knowledge base. Represent some of your favorite | |
% books and authors. | |
author(apprenticeship, dave_hoover). | |
author(getting_real, jason_fried). | |
author(rework, jason_fried). | |
% Find all books in your knowledge base written by one author. | |
author(Book, jason_fried). | |
% Make a knowledge base representing musicians and instruments. | |
plays(john, guitar). | |
plays(watson, guitar). | |
plays(lennon, piano). | |
plays(me, none). | |
% Also represent musicians and their genre of music. | |
genre(john, rock). | |
genre(watson, pop). | |
genre(lennon, jazz). | |
genre(me, dance). | |
% Find all musicians who play the guitar. | |
plays(Musician, guitar). |
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
% Some free Prolog tutorials | |
http://www.csupomona.edu/~jrfisher/www/prolog_tutorial/contents.html | |
http://proton.ucting.udg.mx/tutorial/prolog/index.htm | |
% A support forum (there are several) | |
http://www.tek-tips.com/threadminder.cfm?pid=345 | |
% One online reference for the Prolog version you’re using | |
http://www.swi-prolog.org/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment