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

From: Alvin Ryder <alvin321_at_telstra.com>
Date: 26 Apr 2006 16:34:07 -0700
Message-ID: <1146094447.260458.63810_at_v46g2000cwv.googlegroups.com>


Markus Triska wrote:
> Hi,
>
> Nick Malik [Microsoft] wrote:
>
> >
> > Believe it or not, in Prolog, it is a bit tougher to ask: what are all the
> > fruits that John likes,
>
> It's still fairly trivial:
>

You're both right.

Nick's point is correct, pure prolog does not answer those types of questions, it only deals with first-order logic and that's a second order question, which requires predicates themselves, like "likes", to become arguments.

> > vegetables that john likes would look like this:
>
> ?- findall(Veg, likes(john,vegetable,Veg), Vegs).
>
> Vegs = [broccoli, tomato]
>

And you're right, practical prolog's let you roll your own solutions or use things like "bagof", "setof" and "findall" which return lists and solve these problems trivially.

Cheers. Received on Thu Apr 27 2006 - 01:34:07 CEST

Original text of this message