🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.prolog
Article #1809

Re: general data structures are impossible

#1809
From: David Bowen
Date: Sun, 17 Feb 1991 02:07
27 lines
2256 bytes
The point of using Prolog is to program at a "higher level" than is
possible with languages like C; that is, to write code which is more
closely related to the problem that you are trying to solve than to the
machine on which the program is to be run.

Pointers are a low-level concept.  The lack of pointers in Prolog is one of
its major advantages.  Since there are no pointers there are no dangling
pointers, and one major source of difficult-to-debug programming errors is
entirely eliminated.

I agree with you that using infinite structures in Prolog is more trouble
than its worth.  If the problem to be solved intrinsically requires a
complex data structure such as a cone, then I would suggest writing at
least part of your program in a language like C.  You may be able to have
the best of both worlds by defining the cone as an abstract data type in C,
and making all the operations on that data type available to Prolog.

The way that I would program your original example of a tree where each
node contains data about a person, and you want constant time access from a
person to his/her spouse, is to put all the data about the individuals into
the Prolog database.  Assuming that you have some good way of identifying
individuals (either by name or by some unique identifying number), and
assuming that your Prolog system gives you good (hash-table) indexing, you
can have essentially constant time access to any record.  You can then
build the tree with the nodes containing only the identifying numbers of
the persons, and look in the database whenever more information is needed.
Technical Details
Message-ID: <1489@quintus.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!mnetor!tmsoft!torsqnt!news-server.csri.toronto.edu!cs.utexas.edu!sun-barr!newstop!sun!quintus!dave
References: <1991Feb12.013413.24312@cs.ubc.ca> <4765@goanna.cs.rmit.oz.au> <1991Feb13.235655.6202@cs.ubc.ca> <17853@cs.utexas.edu> <1948@n-kulcs.cs.kuleuven.ac.be> <17899@cs.utexas.edu> <1991Feb15.101435.16112@ecrc.de> <17914@cs.utexas.edu>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!mnetor!tmsoft!torsqnt!news-server.csri.toronto.edu!cs.utexas.edu!sun-barr!newstop!sun!quintus!dave
From: dave@quintus.UUCP (David Bowen)
Newsgroups: comp.lang.prolog
Subject: Re:  general data structures are impossible
Message-ID: <1489@quintus.UUCP>
Date: 17 Feb 91 02:07:41 GMT
References: <1991Feb12.013413.24312@cs.ubc.ca> <4765@goanna.cs.rmit.oz.au> <1991Feb13.235655.6202@cs.ubc.ca> <17853@cs.utexas.edu> <1948@n-kulcs.cs.kuleuven.ac.be> <17899@cs.utexas.edu> <1991Feb15.101435.16112@ecrc.de> <17914@cs.utexas.edu>
Reply-To: dave@quintus.UUCP (David Bowen)
Organization: Quintus Corporation
Lines: 27