Prolog is a logic programming language. It is a general purpose language often associated with artificial intelligence and computational linguistics. It has a purely logical subset, called "pure Prolog", as well as a number of extralogical features.I started to study Prolog in the University and I'm looking in the web for some resources. I found a lot! This are some of the links:
- http://en.wikipedia.org/wiki/Prolog
- http://www.csupomona.edu/~jrfisher/www/prolog_tutorial/contents.html
- SWI Prolog (Compiler - Interpreter)
- http://cs.wwc.edu/KU/PR/Prolog.html
One thing that surprise me a lot, was this:
% Declare a Graph
node(a).
node(b).
node(c).
node(d).
node(e).
link(a,b).
link(b,c).
link(b,d).
link(c,e).
exist_path(X,Y) :- link(X,Y).
exist_path(X,Y) :- link(X,Z),exist_path(Z,Y).
this code define a graph with a,b,c,d,e as nodes and [(a,b),(b,c),(b,d),(c,e)] as links.
exist_path is predicate, an define if exist a path from node X to node Y, if exist the result is TRUE, if not FAIL (FALSE).
This simple code leave me amazed!
No hay comentarios.:
Publicar un comentario