From 50000481@plink.cityu.edu.hk Thu Feb 15 15:55:34 2001
Received: from plink2.cityu.edu.hk (carol.cityu.edu.hk [144.214.5.208])
	by swi.psy.uva.nl (8.11.2/8.11.2) with ESMTP id f1FEtXZ07326
	for <prolog@swi.psy.uva.nl>; Thu, 15 Feb 2001 15:55:34 +0100 (MET)
Received: from wong (pppb003.dialup.cityu.edu.hk)
 by plink2.cityu.edu.hk (Sun Internet Mail Server sims.3.5.1999.03.02.17.58.p5)
 id <0G8T00I01043MU@plink2.cityu.edu.hk> for prolog@swi.psy.uva.nl; Thu,
 15 Feb 2001 22:55:16 +0800 (HKT)
Received: from wong (pppb003.dialup.cityu.edu.hk)
 by plink2.cityu.edu.hk (Sun Internet Mail Server sims.3.5.1999.03.02.17.58.p5)
 with SMTP id <0G8T00GE6041XG@plink2.cityu.edu.hk> for prolog@swi.psy.uva.nl;
 Thu, 15 Feb 2001 22:55:14 +0800 (HKT)
Date: Thu, 15 Feb 2001 23:03:15 +0800
From: Cecilia Wong <50000481@plink.cityu.edu.hk>
To: prolog@swi.psy.uva.nl
Message-id: <002b01c09760$6d595700$03e1d690@wong>
MIME-version: 1.0
X-Mailer: Microsoft Outlook Express 5.00.2615.200
Content-type: text/plain; charset="big5"
Content-transfer-encoding: 7bit
X-MSMail-Priority: Normal
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2615.200
X-Priority: 3
Subject: [SWIPL] using bagof

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!

