2 Using the Container Libraries

The container libraries consists of a number of fragments: container, collection, sets, classification, arrayContainer, hashTable, seqContainers, list and recList:

An application may utilize the container libraries by including the appropriate library fragment. E.g. in order for an application to utilize the multiSet pattern, the application must have the following outline:

ORIGIN '~beta/basiclib/betaenv';
INCLUDE '~beta/containers/sets'
--- program: descriptor ---
(# ...
   recordBag: @multiSet(# element:: record #);
   aRecord: @record;
   aPerson: @person; (* person is a subpattern of record *)
   ...
do ...
   recordBag.init;
   ...
   aPerson[] -> recordBag.insert;
   ...
   aRecord[] -> recordBag.insert;
   ...
   recordBag.scan(# where:: (# current.key<3000 -> value #)
                 do current.print
                 #);
   (* prints all records in recordBag that has a key less that 
    * 3000. It is assumed that record implements a virtual print 
    * operation
    *)
   ...
#)
In order to utilize the other fragments, just replace

INCLUDE '~beta/containers/sets'
with e.g.

INCLUDE '~beta/containers/hashTable'
and in order to use more than one container fragment, just insert several INCLUDEs:

INCLUDE '~beta/containers/sets';
INCLUDE '~beta/containers/hashTable'
Note that since the container fragments has ORIGIN in betaenv, the above is equivalent to:

ORIGIN '~beta/containers/sets'
--- program: descriptor ---
(# ...
   recordBag: @multiSet(# element:: record #);
   ...
do ...
   ...
#)


Container Libraries - Reference Manual
© 1992-2002 Mjølner Informatics
[Modified: Thursday October 19th 2000 at 12:51]