🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.prolog
Article #867

Re: Why is bagof so slow?

#867
From: Richard A. O'Keefe
Date: Fri, 01 Jun 1990 03:23
20 lines
1590 bytes
In article <14004@burdvax.PRC.Unisys.COM>, lang@PRC.Unisys.COM (Francois-Michel Lang) writes:
> 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?

Sure it's possible.  I'm the one that put findall/4 in the library.
However, it's worth pointing out that in
	setof(Template, Generator, Set),
	append(Set, OldSet, NewList)
you _don't_ get a set out the other end, just a NewList with no special
properties.  The analogue of findall/4 would be
	setof(Template, Generator, Set),
	ord_union(Set, OldSet, NewSet)
which isn't the kind of thing you can do with difference lists.  And in
the case of bagof/3, the cost of doing an extra append/3 afterwards is
typically a small fraction of the cost of the bagof/3 (10%, say).
It's better to put the effort into better sorting routines.
-- 
"A 7th class of programs, correct in every way, is believed to exist by a
few computer scientists.  However, no example could be found to include here."
Technical Details
Message-ID: <3125@goanna.cs.rmit.oz.au>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rutgers!uwm.edu!zaphod.mps.ohio-state.edu!samsung!munnari.oz.au!bruce!goanna!ok
References: <2556@randvax.UUCP> <3086@goanna.cs.rmit.oz.au> <2559@randvax.UUCP> <14004@burdvax.PRC.Unisys.COM>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rutgers!uwm.edu!zaphod.mps.ohio-state.edu!samsung!munnari.oz.au!bruce!goanna!ok
From: ok@goanna.cs.rmit.oz.au (Richard A. O'Keefe)
Newsgroups: comp.lang.prolog
Subject: Re: Why is bagof so slow?
Keywords: bagof, setof
Message-ID: <3125@goanna.cs.rmit.oz.au>
Date: 1 Jun 90 03:23:03 GMT
References: <2556@randvax.UUCP> <3086@goanna.cs.rmit.oz.au> <2559@randvax.UUCP> <14004@burdvax.PRC.Unisys.COM>
Organization: Comp Sci, RMIT, Melbourne, Australia
Lines: 20