How to expand a search
- From: "RichardIII" <RichardDummyMailbox58407@xxxxxxxxxxxxxxxxxxx>
- Date: 14 Apr 2007 16:51:55 -0700
Hi All,
I'm a Prolog nubie relying on a couple of on-line tutorial and the
documentation from SWI-Prolog, which I'm running on WinXP-Pro/SP2.
I found a simple example on the web that listed cuisine the "sam"
likes, which I expanded with what "joe" likes. The "facts" are shown
below, which are "consulted".
The queries:
12 ?- setof(Z, likes(sam, Z), Result).
13 ?- setof(Z, likes(joe, Z), Result).
14 ?- setof(Z, likes(Guy, Z), Result).
produce:
Result = [chips, pizza, spaghetti]
Result = [hero]
Guy = sam,
Result = [chips, pizza, spaghetti]
How can I embed #14 with a query that gets an array of all the Guys
and feeds them to #14 so that every Guy will be named followed by his
cuisines? Only sam gets returned in #14, no doubt because he's the
first Guy listed in the facts.
I'm confident that reading every word of the tutorials will eventually
tell me everything I'd like to know, but I'd like to accelerate the
process so I can get my application running.
TIA,
Richard
"Facts" (Test1x.pl)
==============
likes(sam,Food) :-
italian(Food).
likes(sam,chips).
likes(joe, Food):-
deli(Food).
italian(pizza).
italian(spaghetti).
deli(hero).
.
- Follow-Ups:
- Re: How to expand a search
- From: student
- Re: How to expand a search
- From: bart demoen
- Re: How to expand a search
- From: A . L .
- Re: How to expand a search
- From: RichardIII
- Re: How to expand a search
- Prev by Date: Re: Prolog beginner
- Next by Date: Re: How to expand a search
- Previous by thread: Prolog beginner
- Next by thread: Re: How to expand a search
- Index(es):
Relevant Pages
|
|