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

why not use LISP-imp of Prolog as opposed to Prolog itself?

60 views
Skip to first unread message

globalrev

unread,
May 13, 2008, 4:51:14 PM5/13/08
to
is there an actual reason to use swi-prolog or the like as opposed to
just use an implementation of Prolog in Lisp?

it seems Prolog is a special-purpose language and the
turingcompleteness is fairly pointless and just there for the cause of
being turingcomplete.
and thus better to have a real general-purpose language with prolog
implemented in that language so you can easily write your application
and then dont have to run code between 2 different languages.

or how big of a fool am i? this is just my quick/first impression of
prolog.

globalrev

unread,
May 14, 2008, 12:44:30 AM5/14/08
to
http://www.amazon.com/gp/product/1558601910/002-6413815-3000828?v=glance&n=283155

Lisp has been getting a higher profile lately because of essayists
like Paul Graham and Philip Greenspun; in particular, Greenspun's
Tenth Rule of Programming which states: "Any sufficiently complicated
C or Fortran program contains an ad hoc, informally-specified, bug-
ridden, slow implementation of half of Common Lisp." So, should this
book be read as an exhortation to return to Lisp as the preferred
programming language?

Paradoxically, I think not. One third of the way through the book,
Norvig shows us how to implement Prolog in Lisp. From then on out,
most of the AI techniques he presents either directly use Prolog
instead of Lisp (such as his excellent discussion of natural language
processing using Prolog) or use Prolog as a base to build on (such as
his discussions on knowledge representation).

From this we can abstract what I'd like to call Norvig's Corollary to
Greenspun's Tenth Law of Programming: "Any sufficiently complicated
LISP program is going to contain a slow implementation of half of
Prolog". I'm leaving out the "ad hoc", "bug-ridden" part of
Greenspuns's law, because Norvig's programs are neither. But it is
quite remarkable the degree to which, once having absorbed Prolog,
Norvig uses Prolog as the basis for further development, rather than
Lisp.

Is this a book about Prolog then? Again, no. What is the take-away
message? It is this: as our world becomes more and more complex, and
as the problems which programmers are facing become more and more
complex, we have to program at a higher and higher level.

Alessio Stalla

unread,
May 14, 2008, 5:36:05 AM5/14/08
to
globalrev ha scritto:

It's not a book about Prolog, but it's a book about a field of
computer science where Prolog really shines (well, it was invented
precisely for that ;), so it's only natural to use Prolog-like
features everywhere. To my eyes and mental model, though, Lisp feels
more "general purpose" than Prolog, and the very fact Norvig shows how
to "add" Prolog to Lisp with limited effort is a confirmation in that
direction IMHO. Keep in mind that Norvig's Prolog implementation is
"slow" and "half" because it is code included in a book.
AllegroProlog, which was developed starting from PAIP Prolog, is
supposedly very fast (see http://bc.tech.coop/blog/040919.html and
http://bc.tech.coop/blog/040920.html), and probably more feature-
complete too. That said, which language to use depends both on the
task AND on the programmer's tastes (and sadly on other more mundane
factors as availabilty of libraries, which tend to give advantage to
already popular languages). If you feel Prolog is the right tool for
the problem you want to solve, use it all the way.

Cheers
Alessio Stalla

bart demoen

unread,
May 15, 2008, 4:03:11 PM5/15/08
to
On Tue, 13 May 2008 14:51:14 -0700, globalrev wrote:

> is there an actual reason to use swi-prolog or the like as opposed to
> just use an implementation of Prolog in Lisp?

Yes there is: Lisp can be (and was) implemented in Prolog (search for
Lisprolog in Google for one example). The point is: you never really want
Lisp; what you want is Prolog. So why not go for the real thing instead of
the embedded interpreter ?


> it seems Prolog is a special-purpose language and the

No, Prolog is general purpose.

> turingcompleteness is fairly pointless

No it isn't, it is essential in almost anything one wants to program.


> and just there for the cause of
> being turingcomplete.

BTW, Lisp is Turing Complete - otherwise it would not be possible to write
a Prolog in Lisp.

> and thus better to have a real general-purpose language with prolog

Prolog is a real general purpose language.

> implemented in that language so you can easily write your application

You can easily write your application in Prolog.

> and then dont have to run code between 2 different languages.

And that wouldn't even be a bad thing, so why worry about it.


> or how big of a fool am i?

I pass on this one.

Cheers

Bart Demoen

Duncan Patton

unread,
May 16, 2008, 3:38:35 AM5/16/08
to
On Thu, 15 May 2008 22:03:11 +0200
bart demoen <b...@cs.kuleuven.be> wrote:

> On Tue, 13 May 2008 14:51:14 -0700, globalrev wrote:
>
> > is there an actual reason to use swi-prolog or the like as opposed to
> > just use an implementation of Prolog in Lisp?
>
> Yes there is: Lisp can be (and was) implemented in Prolog (search for
> Lisprolog in Google for one example). The point is: you never really want
> Lisp; what you want is Prolog. So why not go for the real thing instead of
> the embedded interpreter ?
>
>
> > it seems Prolog is a special-purpose language and the
>
> No, Prolog is general purpose.
>
>
>
> > turingcompleteness is fairly pointless
>
> No it isn't, it is essential in almost anything one wants to program.
>
>

There are non-Turing complete languages. They are just fairly useless.

Dhu

Peter Van Weert

unread,
May 16, 2008, 6:14:43 AM5/16/08
to
Duncan Patton wrote:
> There are non-Turing complete languages. They are just fairly useless.

That is most definitely not true. Are Petri Nets useless? Is SQL
useless? No. There are several examples of very useful domain-specific
languages that aren't Turing powerful.

Peter


Peter_VanWeert.vcf

Duncan Patton

unread,
May 16, 2008, 1:39:18 PM5/16/08
to

Just try any non-trivial programming without access
to a Turing-complete language sometime and you will
know what I mean. Non-Turing languages are, at the
very best, language extensions. Usually they are
an excuse to waste money and blow smoke: like our
Canadian Gun Control Registry that was written in
MS Access.

Dhu

> Peter
>
>
>

0 new messages