Re: 2 questions

From: Joachim Schimpf (j.schimpf_at_imperial.ac.uk)
Date: 04/16/04


Date: Fri, 16 Apr 2004 10:01:24 +0100

Budyn wrote:
>
> 2) ?- findall(X, append(X, _, [A,B,C]), L).
> gives
> X = _G166
> A = _G157
> B = _G160
> C = _G163
> L = [[], [_G343], [_G331, _G334], [_G316, _G319, _G322]]
>
> why not:
>
> L = [[], [A], [A, B], [A, B, C]]
>
> (i want to instantiate A later)

You need something like

?- bagof(X, T^append(X, T, [A,B,C]), L).

Your manual should contain a discussion of the differences between
findall/bagof/setof and the related variable quantification issues.

-- Joachim