Re: Storing data and code in a Db with LISP-like interface

From: Neo <neo55592_at_hotmail.com>
Date: 28 Apr 2006 21:47:55 -0700
Message-ID: <1146286075.115813.233320_at_g10g2000cwb.googlegroups.com>


> > 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).

> Get ready for a really long program! likes(john, mary). That's it.
> The query looks like this: ?- likes(john, Who)
> the response is: Who = mary
> Not much to it really. I guess it is only interesting in the fact that
> your language takes about 30 lines to do what Prolog does in, what, one?

:) The number of lines to do something isn't particular a good way to evaluate more important aspects. Here dbd (db for dummies) does the 30 lines in two too! It creates a new thing named john who is a person and person is a thing; a new thing named like which is a verb which is a thing; a new thing named mary who is a person and a doctor which are things; and creates the relationship "john like mary", all in one line.

(create (new 'john' 'person') (new 'like' 'verb') (new 'mary' 'person' 'doctor'))
(select john like *)

Now you are ready for the Food Judge Example C posted above! Received on Sat Apr 29 2006 - 06:47:55 CEST

Original text of this message