sharing terms in setof
Don Smith
dsmith at rsn.cirl.uoregon.edu
Tue Oct 21 04:07:17 AEST 1997
I am writing a Prolog application which builds a graph structure level
by level. To extend the (ground) graph to a new level the program calls
setof/3 to collect solutions, each of which references the graph from
earlier levels. When I run the program under sicstus 2.1, eclipse 3.5.2,
or BinProlog 5.0, it uses way too much memory. The problem seems to be
that setof/3 copies terms in each solution, so each time a new solution
is collected the entire existing graph is copied, even though the graph
is ground and could in fact be shared.
I need a Prolog which will be smart enough to (let me specify that it's OK
to) copy only the new part of each solution. Do you think Mercury might
do this, thanks to its use of mode info? Will any standard Prologs let
me do this?
Don (dsmith at cirl.uoregon.edu)
More information about the users
mailing list