How to expand a search



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

.



Relevant Pages

  • Re: How to expand a search
    ... I found a simple example on the web that listed cuisine the "sam" ... Result = [chips, pizza, spaghetti] ... I'm confident that reading every word of the tutorials will eventually ...
    (comp.lang.prolog)
  • Re: How to expand a search
    ... Result = [chips, pizza, spaghetti] ... Only sam gets returned in #14, ...
    (comp.lang.prolog)
  • Re: How to expand a search
    ... Result = [chips, pizza, spaghetti] ... Only sam gets returned in #14, ...
    (comp.lang.prolog)
  • Re: How to expand a search
    ... I found a simple example on the web that listed cuisine the "sam" ... Result = [chips, pizza, spaghetti] ...
    (comp.lang.prolog)
  • Re: How to expand a search
    ... I found a simple example on the web that listed cuisine the "sam" ... Result = [chips, pizza, spaghetti] ...
    (comp.lang.prolog)