Path: utzoo!yunexus!geac!syntron!jtsv16!uunet!peregrine!elroy!ames!ll-xn!mit-eddie!bloom-beacon!mcgill-vision!odyssee!iros1!ouareau!tarau From: tarau@ouareau.iro.umontreal.ca (Paul Tarau) Newsgroups: comp.lang.prolog Subject: Must 'all-solutions' predicates create copies of their generator ? Message-ID: <628@mannix.iros1.UUCP> Date: 12 Aug 88 16:37:35 GMT Article-I.D.: mannix.628 Sender: news@iros1.UUCP Reply-To: tarau@iros1.UUCP (Paul Tarau) Organization: Universite de Montreal Lines: 29 When trying to find pure Prolog versions of specific 'all_solutions' predicates like 'all_permutations' I faced the following dilemma: For example, after all_solutions(X,member(X,Xs1),Xs2), when Xs1 may contain free variables, must Xs1 and Xs2 be the 'same' object, or Xs2 must be a fresh copy of Xs1? Then I looked at Quintus's 'bagof' and the library predicate 'findall': test1:- Xs1=[A,B,A], findall(X,member(X,Xs1),Xs2), Xs1==Xs2. test2:- Xs1=[A,B,A], bagof(X,member(X,Xs1),Xs2), Xs1==Xs2. As 'test1' fails and 'test2' succeeds, it seems that copying may be just a consequence of findall's 'database-hack' implementation and not a 'feature'. Have someone 'logical' reasons for one of these alternatives? Paul Tarau