Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Things left out of Borland's Prolog

7 views
Skip to first unread message

Ted Holden

unread,
Nov 4, 1986, 10:35:38 PM11/4/86
to

There's a paragraph in the September issue of Dobbs Journal which I can't
get over:

"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? 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

Theodore S. Norvell

unread,
Nov 6, 1986, 2:09:21 PM11/6/86
to
> "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.

0 new messages