Re: seeking findall that preserves variables.

Michael Ben Yosef <[email protected]> Thu, 24 Apr 2014 09:48:25 +0200
Newsgroups gmane.comp.ai.prolog.swi
Message-ID <CABnaNcposW5xQ940NgJi=V7367GNf3DGQMj_P_32iDpkuRMVRw@mail.gmail.com>
Hi Alan,

bagof/3 preserves variables:

?- bagof(X, member(X-1, [A-1, B-2, C-1]), Xs), Xs == [A, C].
Xs = [A, C].

Hope that helps!

Michael


On 23 April 2014 22:07, Alan Baljeu <[email protected]> wrote:
> I have a notion that there's something out there that uses attributed variables
> or something so that I can collect the solutions of a predicate without
> destroying the variables in that solution.
>
> E.g.  nice_findall(X, member(X-1, [A-1, B-2, C-1], Xs), Xs == [A, C].
>
> Does it exist/can it be easily done?  (The actual source is not a list,
> so filter predicates aren't the answer.)
>
> Alan Baljeu
> -------------- next part --------------
> HTML attachment scrubbed and removed
> _______________________________________________
> SWI-Prolog mailing list
> [email protected]
> https://lists.iai.uni-bonn.de/mailman/listinfo.cgi/swi-prolog