List recursion
From: jex (sales_at_jexnet.com)
Date: 02/29/04
- Next message: Martin Sondergaard: "Re: Beginner"
- Previous message: Ian Jones: "Re: Beginner"
- Next in thread: Tom Breton: "Re: List recursion"
- Reply: Tom Breton: "Re: List recursion"
- Reply: Christian Heinze: "Re: List recursion"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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.
- Next message: Martin Sondergaard: "Re: Beginner"
- Previous message: Ian Jones: "Re: Beginner"
- Next in thread: Tom Breton: "Re: List recursion"
- Reply: Tom Breton: "Re: List recursion"
- Reply: Christian Heinze: "Re: List recursion"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|
|