AI-Prolog

 view release on metacpan or  search on metacpan

bin/aiprolog  view on Meta::CPAN

=head2 Commands

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.

=head2 Typical session

Save the following to a file named "append.pro":

 append([],X,X).

lib/AI/Prolog/Article.pod  view on Meta::CPAN

Finally, because all arguments are variables, we're asking for everyone who
will give anything to anybody.

Note that no code changes are necessary for any of this.  Because Prolog facts
and rules define relationships between things, Prolog can automatically infer
additional relationships if they are logically supported by the program.

Let's take a closer look at this, first focusing on the C<aiprolog> shell.
Assuming you've installed C<AI::Prolog> and said "yes" to installing the
C<aiprolog> shell, enter the following text in a file and save it as
I<gives.pro>.  Note that lines beginning with a percent sign (C<%>) are
single-line comments.

 % who are people?
 person(bob).
 person(sally).
 person(tom).
 person(alice).
 
 % who likes whom?
 likes(tom, bob).



( run in 0.336 second using v1.01-cache-2.11-cpan-05162d3a2b1 )