List recursion

From: jex (sales_at_jexnet.com)
Date: 02/29/04


Date: 29 Feb 2004 09:57:19 -0800

Hello, I'm new to prolog and I'm having trouble solving this rather
simple problem.

Series of facts:
related(john, sally).
related(john, lisa).
related(john, mark).

I want to write a function that will retreive all of the relatives of
a given individual. For example, when given the prompt:
related_to(john,X), prolog would respond with a list: X = [sally,
lisa, mark].

Currently, I only get the response:
X = sally ;
X = lisa ;....
and I have to manually output it.

Any help would be appreciated.



Relevant Pages

  • Something else Men can thank feminism for....
    ... Every day there is some reminder of what Mark Harris calls 'the lost years'. ... Lisa missed a lot, too. ... 'There were times when I needed a father figure - for reassurance and advice,' ... 133 court appearances before 33 ...
    (soc.men)
  • Jailed For Waving At My Daughter
    ... Every day there is some reminder of what Mark Harris ... Lisa missed a lot, too. ... still coming to terms with the fact that her father ... for waving to them after a court order demanded he sever ...
    (soc.men)
  • Re: List recursion
    ... goal, e.g. findall/3. ... Consult the manual of the particular Prolog ... related(john, lisa). ... related(john, mark). ...
    (comp.lang.prolog)
  • Re: List recursion
    ... sales@jexnet.com writes: ... > Series of facts: ... > related(john, lisa). ... > related(john, mark). ...
    (comp.lang.prolog)
  • Re: Kopfzeile + Fußzeile
    ... Hi Lisa, ... Benutze Word 2003. ... > "Mark Keller"schrieb im Newsbeitrag ... Next by Date: ...
    (microsoft.public.de.word.vba)