Skip to content

Instantly share code, notes, and snippets.

@japaz
Created October 14, 2011 21:30
Show Gist options
  • Save japaz/1288415 to your computer and use it in GitHub Desktop.
Save japaz/1288415 to your computer and use it in GitHub Desktop.
7L7W Prolog - Day 1
% 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).
% 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