Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine

Kudos. Yet.. Misconception.

by RocketInABog (Initiate)
on Jul 25, 2006 at 06:30 UTC ( #563432=note: print w/replies, xml ) Need Help??

in reply to Bringing Logic Programming to Perl

Wonderful addition to Perl.

My very first posting on the internet was on the subject of prolog programming (I just couldn't bear reading one person mislead another).

I usually only speak up when I have a criticism, so people tend to hate me.
Yet, we should always help each other progress, so....

It looks to me like your conception of the word 'append' is backwards.

In your writing you state:
 "X is qw/b c/. Y is qw/d e f/. Z is qw/b c d e f/"
 "But how do we know if X appended to Y forms Z?"

It's my understanding that when you append something, you place it at the end.
Typically, we append items to a list or queue.
As an example:
 q3 appended to q1 q2 would yield q1 q2 q3 .
So your statement about X Y and Z should be:
 "But how do we know if Y appended to X forms Z?"

One of the things I love about computer science is how definite terms can be. It's important to keep it that way. I don't mean to knock you, but it is very important that we don't mislead one another. Most people do this all day long with sloppy speech (sloppy speech == sloppy thinking).

The only other thing I have to say is that I don't think your choice of appending lists is a very convincing example of using prolog for people who know nothing of the subject.
It's a lot of explaining for something a person could do in one line of Perl:
 push @A, $B; # - append B to the array A

You do show the power of Prolog when you wrote:
"Given Y and Z, we can infer X."
"..given Z, we can infer all X and Y.."

Those are two additional things you get from a Prolog "append" clause which you don't get in any other non-logic programming language.

You understated the biggest point as a note:
 "Note that you get all of that from one definition of how to append two lists. You also don't have to tell the program how to do it. It just figures it out for you."

That is the real power of Prolog.

I'm a fan of using an example of sibling relationships to show how prolog can infer answers using a small number of rules. The only two Prolog books I own use this type of example in their first chapters.

All said and done. Kudos for pushing Prolog.
I'm using your code and appreciate it. Thanks.

BTW Have you heard of Prolog++ ? It's an object oriented prolog.
I bought the book. (No. I'm not affiliated in any way).
(1994, Addison-Wesley published "Prolog++: The Power of Object-Oriented and Logic Programming" by Chris Moss)
I think you can implement the object oriented language in prolog (a prolog meta-interpreter).
Too much for me to chew right now.

Thanks again.

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://563432]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (5)
As of 2022-08-10 08:43 GMT
Find Nodes?
    Voting Booth?

    No recent polls found