AI::Prolog heading to the CPAN

Ovid on 2005-01-23T20:24:46

I have uploaded AI::Prolog 0.02 and it should be hitting the CPAN soon. If you know Prolog, there's enough there to get you started including an examples/ directory showing its use. If you don't know Prolog, it points you to Michael Barták's Guide to Prolog Programming. It's an easy language to learn, though a tough one to master.

Eventually the interface will allow something like this:

  use AI::Prolog 
    functors => [qw/append/],
    vars     => [qw/W X Y Z/],
    import   => 1; # imports builtins like HEAD(X)

  my $logic = AI::Logic->new;
  $logic->assert(
    append([], X, X),
    append([HEAD(W),X],Y,[HEAD(W),Z])
      ->IF(append(X,Y,Z))
  );
  $logic->query(append(X,Y,[qw/a b c d/]));
  while (my $results = $logic->next) {
    my $x = $results->X;
    my $y = $results->Y;
    print "X is [@$x].  Y is [@$y].\n";
  }

But that's not going to happen too soon. For the time being, I'll be happy to start knocking off items on the TODO list (such as math.)