Newsgroups: comp.lang.prolog
Path: cantaloupe.srv.cs.cmu.edu!rochester!cornellcs!newsstand.cit.cornell.edu!portc01.blue.aol.com!news-peer.gsl.net!news.gsl.net!hunter.premier.net!news1.erols.com!howland.erols.net!EU.net!sun4nl!freya.let.rug.nl!vannoord
From: vannoord@let.rug.nl (Gertjan van Noord)
Subject: Re: Finding all
Sender: news@let.rug.nl (News system at let.rug.nl)
Message-ID: <1996Sep25.103710.23839@let.rug.nl>
Date: Wed, 25 Sep 1996 10:37:10 GMT
References: <52arth$60u@euas20.eua.ericsson.se>
Nntp-Posting-Host: grid.let.rug.nl
Organization: Faculteit der Letteren, Rijksuniversiteit Groningen, NL
Lines: 27

In article <52arth$60u@euas20.eua.ericsson.se> euajanne@eua.ericsson.se writes:
>On the goal
>
>| ?- findall(F, (member(X, [a, b]), F=r(X, Y)), Fs).
>
>I got the following answer:
>
>Fs = [r(a,_B),r(b,_A)] 
>
>
>But what I wanted to get was
>
>Fs = [r(a,Y),r(b,Y)] 
>
>
>Apparently using findall is not the right way to get the answer I need.
>I would greatly appreciate if someone could help me with this.
>

bagof(F,X^(member(X, [a, b]), F=r(X, Y)), Fs).



-- 
dr Gertjan van Noord Alfa-informatica, RUG, Postbus 716, 9700 AS Groningen
vannoord@let.rug.nl      tel. +31-50-3635935      fax  +31-50-3636855
http://www.let.rug.nl/~vannoord/
