Re: The Da Vinci Code.



Matthew Huntbach <mmh@xxxxxxxxxxxxxx> writes:

On Wed, 22 Mar 2006, Evan Kirshenbaum wrote:
Matthew Huntbach <mmh@xxxxxxxxxxxxxx> writes:
The theory was wildly over-optimistic, and made claims about the
Prolog language which just don't stand up in practice. My
experience with it is that you only learn to program properly in
it when you start thinking about how it actually works.

No argument there, on any count. But if you want to teach
beginners to use it at a novice level, that's the way you have to
get them to approach it. And it's a really difficult language to
write in if your model of programming is Fortran (or C or Pascal or
Java or ...)

The whole *point* of Prolog was that it was meant to by *easy* for
novices, because it was based on a human notation, logic, and not on
how machines work. But it didn't seem to work out that way, mostly
because most humans seem to find recursion difficult to grasp, even
if they haven't already been brain danaged by exposure to Fortran
etc.

I disagree that the way to get novices into Prolog is to suggest it
all works by magic. In my experience that just leads to more
confusion. In practice I think you have to give them early on a
feeling for it on an operational level.

I don't think either of us were suggesting to tell them "it all works
by magic". You have to (pretty early) explain backtracking and the
basics of logic variables. But I'd expect that you can get a fair
ways without worrying about things like cuts (at any deep level),
database assertions and memoization, the nitty-gritty details of term
unification, clause indexing, pulling terms apart, disjunction, and
the like.

You can find the notes I used for teachingh Prolog years ago on:

http://www.dcs.qmw.ac.uk/~mmh/AINotes/

I don't think I would have started with square as my first example,
since that gets people started thinking of clauses as being
unidirectional (square(X, 25) will simply fail). Of course, when you
get experienced, you realize that most clauses *are*, in fact,
designed to be used in one direction, but at the beginning I would
have stressed that in Prolog that isn't necessarily the case.

--
Evan Kirshenbaum +------------------------------------
HP Laboratories |There are two types of people -
1501 Page Mill Road, 1U, MS 1141 |those who are one of the two types
Palo Alto, CA 94304 |of people, and those who are not.
| Leigh Blue Caldwell
kirshenbaum@xxxxxxxxxx
(650)857-7572

http://www.kirshenbaum.net/


.



Relevant Pages

  • Re: Out of local stack? (SWI)
    ... that your clauses go from the most spécific case to the most général ... all the lines 'Ontimer" and see wich one is always choosen..... ... >>and standard Prolog is pretty simple minded. ...
    (comp.lang.prolog)
  • question about last call optimization
    ... I have a question about last call optimization using euclids algorithm ... Okay the prolog literature gives the procedure as: ... Now will prolog "last call optimize" this. ... What about if we switch the order of the clauses as such: ...
    (comp.lang.prolog)
  • Re: question about last call optimization
    ... Okay the prolog literature gives the procedure as: ... > no alternative clauses. ... then you still have last-call optimization in some Prolog systems (e.g., ...
    (comp.lang.prolog)
  • Re: Beginners questions
    ... > The above clause is OK, since there is no built-in predicate digit/1. ... clauses are ... truths, and prolog can the use these truths to deduce other truths. ...
    (comp.lang.prolog)
  • Re: removing the largest item from the list
    ... Quoting Martin Sondergaard in comp.lang.prolog: ... develop total dislike of the Prolog language and it's seemingly closed ... Is there really a desire within the Prolog Community to increase Prolog's ...
    (comp.lang.prolog)