Path: utzoo!yunexus!ists!helios.physics.utoronto.ca!news-server.csri.toronto.edu!mailrus!wuarchive!udel!burdvax!lang From: lang@PRC.Unisys.COM (Francois-Michel Lang) Newsgroups: comp.lang.prolog Subject: Re: Why is bagof so slow? Keywords: bagof, setof Message-ID: <14004@burdvax.PRC.Unisys.COM> Date: 31 May 90 13:48:32 GMT Article-I.D.: burdvax.14004 References: <2556@randvax.UUCP> <3086@goanna.cs.rmit.oz.au> <2559@randvax.UUCP> <3110@goanna.cs.rmit.oz.au> Sender: news@PRC.Unisys.COM Organization: Unisys Corporation, Paoli Research Center; Paoli, PA Lines: 36 This is indirectly related to the speed of bagof/3: Do any (current or former) implementors out there have any thoughts about the possibility of providing built-in versions of bagof/setof that return a difference list? E.g., given f(1). f(2). f(3). f(4). we could do | ?- bagof_dl(X, f(X), List, Tail). X = _495, List = [1,2,3,4|Tail], Tail = _542 | ?- I isn't hard to write a version of *findall* that returns a difference list (after writing one myself I discovered one in the library...), but I haven't tried doing the same thing with bagof/setof. Another problem is that anything user-defined would have to use the ``expensive'' versions of assert/retract instead of the ``special cheap'' versions (presumably not accessible to users), and therefore be much slower. Any thoughts about this? ---------------------------------------------------------------------------- Francois-Michel Lang (215) 648-2536 Unisys Center for Advanced Information Technology lang@prc.unisys.com Dept of Comp & Info Science, U of PA lang@linc.cis.upenn.edu