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.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
Outside of code tags, you may need to use entities for some characters:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.
| & || & |
| < || < |
| > || > |
| [ || [ |
| ] || ] ||