Re: Storing data and code in a Db with LISP-like interface
Date: 13 Apr 2006 20:54:48 -0700
Message-ID: <1144986888.222283.143660_at_z34g2000cwc.googlegroups.com>
> Prolog also uses linked lists which can be nested. In addition, you can place structures in the list, and the structures can contain atoms and lists and "lists of lists" and "lists of lists and atoms," etc. There is no 'program.' The system is an ordered database of assertions. You start the logic engine by asking a question. The engine attempts to answer the question using the information in the database, matching as it goes, using a depth-first tree search. The underlying math is predicate calculus and horn clauses. Primitives in the language allow you to assert data into the database, thus modifying the 'program'. This allows the system to learn.
.
Thanks for the above info. It seems the focus of Prolog and my db (with
LISP-like interface) are quite different (at least at this time). While
Prolog's primary focus seems to be deducing answering based on
questions and data stored in linked lists; the focus of the
experimental db is to provide the most flexible method of representing
things. I believe I have already surpassed RM. And as far as I can
tell, linked-lists are not even as flexible as RM. IMO, all else is
built upon the ability to store/recall things. Any
weakness/inflexibility at the foundation eventually leads to
limitations in applications built on top of it. This is the case with
RM/SQL. This will also be the case with LISP and Prolog. However, I am
sure currently and for years to come, Prolog/LISP will have better
algorithm for processing whatever data it can store/recall from linked
lists.
Below is a simple example that stores a person named John who likes Mary and then finds who John likes. Could you or someone familiar with Prolog show how to do this. Later I would like to extend the example to distill Prolog's fundamental forte (and possible weakness in representing things).
// Create type person.
(create type instance (new))
(create (it) name (findElseAdd name instance 'person'))
// Create a person named John.
(create person instance (new))
(create (it) name (findElseAdd name instance 'john'))
// Create a person named Mary.
(create person instance (new))
(create (it) name (findElseAdd name instance 'mary'))
// Create verb instance like.
(create verb instance (new))
(create (it) name (findElseAdd name instance 'like'))
// Create John likes Mary.
(create john like mary)
// Who does John like?
// Displays mary.
(msgbox (select john like *))
Received on Fri Apr 14 2006 - 05:54:48 CEST