AI-Prolog

 view release on metacpan or  search on metacpan

examples/if_else.pl  view on Meta::CPAN

#!/usr/local/bin/perl -l
use strict;
use lib qw(../lib/ lib/);
use AI::Prolog;
use Data::Dumper;
$Data::Dumper::Terse = 1;

my $prolog = AI::Prolog->new(<<'END_PROLOG');
thief(badguy).
steals(PERP, X) :-
 if(thief(PERP), eq(X,rubies), eq(X,nothing)).
END_PROLOG
$prolog->query("steals(badguy,X).");
print Dumper $prolog->results;

$prolog->query("steals(ovid, X).");
print Dumper $prolog->results;

 view all matches for this distribution
 view release on metacpan -  search on metacpan

( run in 1.306 second using v1.00-cache-2.02-grep-82fe00e-cpan-2c419f77a38b )