Subject: [SWIPL] using bagof

From: Cecilia Wong <[email-masked]>
Date: Thu, 15 Feb 2001 23:03:15 +0800

Hi,

I've got a problem on using the 'bagof' predicate.
I have the following codes,

proclist([],[]).
proclist([H|Rest], [HP|RestP]):-
 bagof([H, R, M], satall(H, R, M), LOL),
 cons(LOL, LOLC).

and I call the code using: proclist([a, b, c], PL).

My problem found in the line, "bagof([H, R, M], satall(H, R, M), LOL)"
The variable "LOL" was supposed to return a list of list like,
[[a,b],[c,d]].
However, in some cases, the "LOL" will contain nothing. I hope that even
nothing
is returned in LOL, it should still flow the empty list to the procedure,
cons(LOL, LOLC) but it failed whenever LOL is empty and broke the procedure.

Can anyone help? Thanks a lot!