For those who may be curious, some of the initial work on AI::Perlog is coming along 
nicely.

The code in http://www.perlmonks.org/index.pl?node_id=191060 basically implements the 
following
Prolog program.

  steals(PERP, STUFF) :- 
     thief(PERP),
     valuable(STUFF),
     owns(VICTIM,STUFF),
     not(knows(PERP,VICTIM)).
  thief(badguy).
  valuable(gold).
  valuable(rubies).
  owns(merlyn,gold).
  owns(ovid,rubies).
  knows(badguy,merlyn).

We only have the ability to add basic facts, do boolean queries and simple unification 
(it can't
yet unify across more than one predicate).

To do:

1.  Implement lists.

    $pg->add_fact( owns => 'Ovid', [qw/foo bar baz/] );

2.  Embeddeding facts in other facts.

    $pg->add_fact( owns => 'Ovid', book( 'Learning Perl' ) );

3.  Easy-to-create rules.

    Haven't determined the syntax yet.

4.  Unification across multiple predicates

    I can't list a sample in Perl until I get the syntax for 3 down.

If anyone's interested in helping, let me know.

Also, the API is going to change (probably).  All user-defined predicates will have to 
start with
a lower case letter.  This means that I can simply designate upper case predicates as 
reserved
rather than trying to make the user memorize a bunch of built-ins such as 'head', 
'tail',
'add_fact', etc.

Also, the POD for the module is pretty much non-existant (there's a link to a download 
on the link
that I listed above), so you'll have to rely on code samples that I've posted and the 
test suite
that's included.

Cheers,
Curtis "Ovid" Poe

=====
"Ovid" on http://www.perlmonks.org/
Someone asked me how to count to 10 in Perl:
push@A,$_ for reverse q.e...q.n.;for(@A){$_=unpack(q|c|,$_);@a=split//;
shift@a;shift@a if $a[$[]eq$[;$_=join q||,@a};print $_,$/for reverse @A

__________________________________________________
Do You Yahoo!?
HotJobs - Search Thousands of New Jobs
http://www.hotjobs.com

Reply via email to