[mercury-users] Getting all facts of a predicate [was: Still compiling ...]

Fergus Henderson fjh at cs.mu.OZ.AU
Sun Feb 23 13:52:14 AEDT 2003


On 23-Feb-2003, Douglas Auclair <dauclair at msn.com> wrote:
> My problem here is 
> that when I try to represent the facts as a list, in any form, the compiler 
> bogs down unacceptably (i.e. it takes hours to compile a list module).
> 
> Is there some way in Mercury to get all the facts of a predicate at once 
> without relying on list operations to mine the data (perhaps using 
> reflection)?

Yes, the `std_util' module in the Mercury standard library provides a variety
of procedures for that:

	solutions
	solutions_set
	aggregate
	unsorted_solutions
	unsorted_aggregate
	do_while

You can for example implement your data as a fact table and then use
`solutions' to get a list containing all the facts.

See the library reference manual for more details.

-- 
Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
The University of Melbourne         |  of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh>  |     -- the last words of T. S. Garp.
--------------------------------------------------------------------------
mercury-users mailing list
post:  mercury-users at cs.mu.oz.au
administrative address: owner-mercury-users at cs.mu.oz.au
unsubscribe: Address: mercury-users-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-users-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the users mailing list