Path: utzoo!attcan!uunet!husc6!mailrus!cornell!uw-beaver!teknowledge-vaxc!sri-unix!quintus!ok From: ok@quintus.uucp (Richard A. O'Keefe) Newsgroups: comp.lang.prolog Subject: Re: prolog tutorial seattle Message-ID: <359@quintus.UUCP> Date: 7 Sep 88 06:40:55 GMT References: <1430@kulcs.kulcs.uucp> Sender: news@quintus.UUCP Reply-To: ok@quintus.UUCP (Richard A. O'Keefe) Organization: Quintus Computer Systems, Inc. Lines: 63 In article <1430@kulcs.kulcs.uucp> bimbart@kulcs.UUCP (Bart Demoen) continues his 'kind', 'informative', and 'disinterested' comments: >Tutorial No:8 of LP'88 Seattle (R. O'Keefe) makes 'interesting' reading and >even contains some self-referential jokes; read this quotation from section 12.6 >p.141 (it is about a Prolog program that follows immediatly after the quotation) > > 'This code has been tested in Quintus Prolog, and works.' > >So, what should we think about the other programs in the tutorial? Sob, sob, all these years I've been thinking that I had a sense of humour, and now the sham is exposed. I really don't see anything funny in that sentence, especially as it precedes - the longest single chunk of code in the text - the chunk which is least "intuitive" or "Prolog-like" - the chunk which is least well backed up by the text. (the text doesn't go through it clause-by-clause or even predicate-by-predicate). Is a reassurance that the thing has been observed to work (even though it is not explained in detail) really out of place? What are you to think about the other fragments? Well, if you read the rest of the text, you'll find in section "Conditional Reading" of chapter "Using term_expansion/2" the sentence This code, like all the concrete code in this text, has been tested in Quintus Prolog, and works. I *wonder* why Demoen didn't quote that sentence when he asked his rhetorical question? (There are at least two possibilities.) [I have now amended this sentence to read "and appeared to work" (:-).] I'm glad I said "the code", because a typo has been found by two people in the description of in section "Counters" of chapter "Basic Topics": "(M, U, -args-)" should read "(N, U, -args-)". >Or perhaps this was a serious comment, since if you try to run findall_5 (p.151) >or findall (p.152) as they stand ... trouble! Demoen would do all of us a service if, in his criticisms, he would take the trouble to go into detail. The correct code of findall_5/3 is findall_5(Template, Generator, List) :- asserta('find all'([]), MarkRef), ( call(Generator), asserta('find all'(Template)), fail ; 'all found'(MarkRef, [], List) ). I do not have a copy of the tutorial as it was printed for the conference, so I'm not sure if this is what Demoen is talking about, but there was a draft where the code of findall_5/3 and findall/3 had been reindented to make them look more like the code of findall_4/3, and that had introduced a mistake. findall_5/3 and findall/3 should have the shape shown above, where the first asserta/2 is outside the disjunction. The text includes times for several versions of findall; the times refer to the original correct code. Needless to say, the times *are* system-dependent. Lesson for authors: having introduced machine-readable source code into your text, *don't* try to make it look nicer!