Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??

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/"
and..
 "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.
-RocketInABog


In reply to Kudos. Yet.. Misconception. by RocketInABog
in thread Bringing Logic Programming to Perl by Ovid

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (3)
As of 2022-08-18 07:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?