🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: net.micro.pc
Article #8296

Re: Things left out of Borland's Prolog

#8296
From: Theodore S. Norvell
Date: Thu, 06 Nov 1986 19:09
59 lines
3439 bytes
>     "Perhaps the greatest shortcoming of Turbo Prolog as an implementation
>     of Prolog is the lack of what might be called "metalinguistic" functions
>     and operators.  Some of these supplied in Prolog are arg, functor, name,
>     op, clause, and call and the univ operator.  In general, these functions
>     allow the Prolog program to examine itself, to operate on code as data,
>     and to construct new clauses and goals undreampt of by the programmer."
> 
> Now, I don't TRUST my own computer or any of IMS's computers enough to
> let them try to program themselves.... no telling what they might try
> to do.   Can anyone out there give me an example of a legitimate use
> for such a technique, preferably one which could not be achieved with
> more ordinary kinds of programming skills and languages?   

What is a compiler, if not a program which operates on code as data?
If you really don't trust a computer to program itself, let me (rhetoricly)
ask you this: Do you use a compiler, or do you punch hex-codes in to a front
panel?  :-)

Example: Turbo Prolog as supplied can not read definite clause grammars (DCGs).
In most Prologs this would be a minor problem, one simply writes a DCG to 
Prolog compiler.  This complier reads a DCG and translates its non-terminals
into Prolog procedures which then become part of the program.  I doubt
that this can be done in Turbo with the elegance it can be done with in
(more) standard Prologs.

Call is needed for passing procedures as parameters.  Even ``ordinary 
languages'' (Fortran, Pascal, C) support this.  Turbo doesn't.

By the way, arg, functor, name and univ are useful for manipulating all 
kinds of data, not just code.

Also missing from Turbo (I have heard) is the ability to assert rules
(as distinct from facts).

> Any opinions
> as to whether Kahn left these things out of Turbo Prolog because he
> thought they were dangerous or whether he's just being lazy?
> 
> Ted Holden
> IMS
I suspect that they were left out primarily to make the product fast.
Both at compile time (hence no operator definition) and at run time
(hence no call or (full) assert).  The absence of univ etc may to be
related to Turbo Prolog's bizarre type system.

Turbo Prolog is no doubt a good product and a real bargain.  But let the
buyer beware, it is missing many of the features which set Prolog apart 
from other languages.  It is arguably not real Prolog.  Of course not
everyone wants real Prolog because it tends to be slow.  From what I've
heard Turbo is not.
					Theodore Norvell
					DCS U of T

Reference: Clocksin & Mellish, _Programming_in_Prolog_, Springer Verlag 1981
Chapter 9 explains DCGs.  Other chapters give examples of uses of call,
assert, univ etc.

Disclaimer: I haven't used Turbo Prolog yet and would be happy to hear
that it is not as limited as I think.
Technical Details
Message-ID: <3599@utcsri.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!utcsri!norvell
References: <636@imsvax.UUCP>

Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Posting-Version: version B 2.10.2 9/18/84; site utcsri.UUCP
Path: arc1-ca.pugleaf.net!utzoo!utcsri!norvell
From: norvell@utcsri.UUCP (Theodore S. Norvell)
Newsgroups: net.micro.pc,net.lang
Subject: Re: Things left out of Borland's Prolog
Message-ID: <3599@utcsri.UUCP>
Date: Thu, 6-Nov-86 14:09:21 EST
Article-I.D.: utcsri.3599
Posted: Thu Nov  6 14:09:21 1986
Date-Received: Fri, 7-Nov-86 16:57:23 EST
References: <636@imsvax.UUCP>
Organization: CSRI, University of Toronto
Lines: 59