Subject: Re: [SWIPL] Basic Newby question

From: "Pierre Nugues" <[email-masked]>
Date: Wed, 21 Mar 2001 09:20:47 +0100

Bonjour Michael,

Try this:
people_list(Mood, L) :-
 bagof(People, mood(People, Mood), L).

Pierre
--
Pierre Nugues, Professeur d'informatique ([email-masked])
ISMRA, 6, bd du Maréchal Juin, F-14050 Caen, France
Tél. (33) 231-452-705 -- Fax. (33) 231-452-760
http://www.ensicaen.ismra.fr/~nugues
----- Message d'origine -----
De : "Michael J Lew" <[email-masked]>
À : <[email-masked]>
Envoyé : mardi 20 mars 2001 22:46
Objet : [SWIPL] Basic Newby question

> I'm having trouble extracting facts to a list...
> I can't seem to figure out how to for example - extract
> all the names of the happy people to a list, because there
> is no 'non member' function so i end up with infinate
> recursion with the first matching rule inserted to the
> list an infinte number of times.
>
> mood(bob,happy).
> mood(chirs,angry).
> mood(sally,happy).
>
> find_mood(Mood,[Head|Tail])
> mood(Name,Mood),
> Head = [X|Head],
> find_mood(Mood,[Tail]).
>
> I think what I need a how to determine that something is
> not a member, i just have no idea how to accomplish this
> Thanks
>
> Michael Lew
>
>
> ----------------
> * To UNSUBSCRIBE, please use the HTML form at
>
>     http://www.swi.psy.uva.nl/projects/SWI-Prolog/index.html#mailinglist
>
> or send mail to [email-masked] using the Subject:
"unsubscribe"
> (without the quotes) and *no* message body.
>
> ** An ARCHIVE of this list is maintained at
>
>     http://www.swi.psy.uva.nl/projects/SWI-Prolog/mailinglist/archive/
>