Grokbase Groups Perl ai July 2002

--- Lee Goddard wrote:
At 21:35 16/07/2002, Ovid wrote:
In other words, can someone do this:

foo( bar, baz ).
foo( bar, quux, camel ).
Yes. they're essential. Your two predicates would
be foo/2 and foo/3.
Aah. Thanks.
You certainly cannot exclude them from any implimentation
of PROLOG and call it PROLOG - for examples of use, see any
number of textbooks. One thought is a routine that calls
itself with an argument: if there is no argument, it's the
first call. Agh, not clear, sorry, but I've had a very
busy weekend, and am still a tad drunk (just married).
Congratulations! You're a brave man. Not about getting married, but about sending email while
drunk. I've had to apologize on more than one occassion for that (though I got a date out of it
once :)
Good luck -- have you seen the existing Prolog in Perl?
Yes I have. Unfortunately, they do not support rich enough data structures. Currently, none of
them appear to support lists and I don't think they allow facts as arguments to other facts.
Mathematical operations are out the window with them. Language::Prolog *might* be extensible
enough, but I decided not to go that route for a couple of reasons.

1. I don't really want to reimplement Prolog. I want to use a Prolog model to create Perl
programs. For example, returning "no" on false is useless to most Perl programmers. The logic of
Prolog is so straightforward, though, that I thought it would be a good model.

2. The other reason is fairly simple: I'm hardly a Prolog expert. I've worked with quite a few
programming languages, but all of them have been imperative or object oriented. Prolog was my
only excursion into Logic programming and my functional programming knowledge is pretty limited.

There are many who are more qualified than I to write AI::Perlog, but no one seems to be putting
any time towards it. It's kind of like my online CGI programming course. No on seemed to want to
write a *good* CGI course (online, that it), so I concluded that if I wanted it done, I had to do
it myself.

I have work started on an AI::Perlog distro, but presently I can only add facts. When I can start
adding simple rules and support a variety of data types, I'll release an Alpha, but I'm pretty
booked up for the next week or so, so don't hold your breath!

I also expect to throw away several versions (I've already tossed one) while learning this, so
this could be a long process.

Curtis "Ovid" Poe

"Ovid" on
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!?
Yahoo! Autos - Get free new car price quotes

Search Discussions

Discussion Posts


Follow ups

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 5 of 7 | next ›
Discussion Overview
groupai @
postedJul 16, '02 at 4:34p
activeAug 19, '02 at 5:37p



site design / logo © 2021 Grokbase