Slash Boxes
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

Ovid (2709)

  (email not shown publicly)
AOL IM: ovidperl (Add Buddy, Send Message)

Stuff with the Perl Foundation. A couple of patches in the Perl core. A few CPAN modules. That about sums it up.

Journal of Ovid (2709)

Friday March 04, 2005
10:39 PM

AI::Prolog update

[ #23505 ]

Though I've been rather quiet about it (not having much time to work on it the past week), the work on AI::Prolog is continuing. The current version on my hard drive handles numbers quite a bit better, adds the pow/2 predicate (for exponentiation), has a bit of cleanup of the internals and adds trace/0 and notrace/0 predicates. The latter predicates pretty much do what one would expect of Prolog. They control the tracing of the engine's attempts to satisfy Prolog goals. This was in the Perl code itself, but I've pushed it down in the Prolog code because really, that's where it belongs.

I've also taken to lurking on comp.lang.prolog. Many times students ask questions there. Naturally, rather than looking for pointers, they are often just looking for someone to do their homework for them. So I do. I just don't post it back to the list, but it is a nice way to keep in practice. One fun one was to take facts like this:

details(car1, [owner, john, colour, blue, make, ford, type, hatchback, doors, 3]).
details(car2, [colour, red, make, volkswagen, type, saloon, owner, sue]).
details(car3, [owner, ovid, colour, gold, make, saturn, doors, 4, type, sedan]).

And create a predicate that would describe each car but treat the list like a hash of key/value pairs. The following works in both SWI-Prolog and my aiprolog shell:

writelist([]) :- !.

writelist([First, Second|Rest]) :-
    print(First), print(' = '), print(Second), nl,

describe(Car) :-
    details(Car, List),

To be honest, I was actually suprised that worked given that I'm used to treating the head of a list as being a single element :)

I also suppose it's too much to hope that my logic programming proposal was chosen for this year's OSCON, I confess that I'm curious to know if it was accepted or not. I suppose if more than handful of people had even an inkling of what was going on, that would help :)

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
More | Login | Reply
Loading... please wait.