[mercury-users] How to make huge db in Mercury

Fergus Henderson fjh at cs.mu.OZ.AU
Tue May 7 18:03:15 AEST 2002


On 27-Apr-2002, Ondrej Bojar <oboj7042 at ss1000.ms.mff.cuni.cz> wrote:
> As far as I know, Mercury has to actually compile the database in your
> program. (And there is a special technique of so-called "fact tables" just
> for this purpose.) Naturally, you can compile in any number of database
> files you wish, but you cannot load them later, when the program is
> already compiled and linked.
> 
> If you need to load (and forget) data on runtime, you can use predicates
> term_io__read_term/3 and term__try_term_to_type/2, to load the database in
> a data structure (such as a list of facts).

Or just io__read/3.

> Later you can search this data
> structure with simple predicates such as member/2 or anything else you
> write.

Yes.  In many cases it would be best to use one of the data structures from
the Mercury standard library, such as a set, map, bimap, or hash_table.

-- 
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