Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Contact Us
Online Help
Domain Status
Man Pages

Virtual Servers

Topology Map

Server Agreement
Year 2038

USA Flag



Man Pages
AIPROLOG(1) User Contributed Perl Documentation AIPROLOG(1)

aiprolog -- A simple Prolog shell using AI::Prolog.

 usage: aiprolog <optional prolog program name>

"aiprolog" is a simple prolog shell using AI::Prolog as the backend.

See the documentation for more detail on the Prolog features that AI::Prolog currently accepts.

Commands specific to aiprolog shell:

 "% more"     -- enables prompting for more results (default)
 "% no more"  -- disables prompting for more results
 "% nomore"   -- same as "no more"
 "% halt"     -- stops the shell
 "% help"     -- display this message

Note that the percent sign must preceed the command. The percent sign indicates a Prolog comment. Without that, aiprolog will think you're trying to execute a prolog command.

aiprolog-specific commands are case-insensitive.

Save the following to a file named "":

 append([W|X], Y, [W|Z]) :- append(X,Y,Z).

Then load it into the "aiprolog" shell by typing this at a shell:

 aiprolog path/to/

Alternatively, once in the shell, you can load the program with:


In the shell, you should be greeted by a query prompt "?-". At this prompt, you can issue queries against the program. Try entering the following query:


The shell should respond with this:

 append([],[1,2,3,4],[1,2,3,4]) ;

It should then appear to hang. It's waiting for you to type a character. If you type a semi-colon, it will attempt to resatisfy the query. If you keep doing that until there are no more valid results left, you'll see this:

 ?- append(X,Y,[1,2,3,4]).

 append([],[1,2,3,4],[1,2,3,4]) ;

 append([1],[2,3,4],[1,2,3,4]) ;

 append([1,2],[3,4],[1,2,3,4]) ;

 append([1,2,3],[4],[1,2,3,4]) ;

 append([1,2,3,4],[],[1,2,3,4]) ; 


The "No" is just Prolog's way of telling you there are no more results which satisfy your query. If you stop trying to satisfy results before all solutions have been found, you might see something like this:

 ?- append(X,Y,[1,2,3,4]).

 append([],[1,2,3,4],[1,2,3,4]) ;

 append([1],[2,3,4],[1,2,3,4]) ;




The "Yes" simply says that Prolog found results for you.

If you are hoping to use this to play the bundled "Spider" game, I recommend the following:

 aiprolog location/of/

 ?- % no more

That disables the pause where the shell waits for you to hit a ';' to get more results or hit enter to continue. It gets very annoying while playing the game, though it's useful when you really want to program.

Then issue the "start" command (defined in "").

 ?- start.
2007-01-15 perl v5.32.1

Search for    or go to Top of page |  Section 1 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.