Bidirectional assocs
Factor handbook > The language > Collections

Prev:Linked assocs

A bidirectional assoc combines a pair of assocs to form a data structure where both normal assoc operations (eg, at), as well as Transposed assoc operations (eg, value-at) run in sub-linear time.

Bidirectional assocs implement the entire Associative mapping protocol with the exception of delete-at. Duplicate values are allowed, however value lookups with value-at only return the first key that a given value was stored with.

The class of biassocs:

biassoc? ( object -- ? )

Creating new biassocs:
<biassoc> ( exemplar -- biassoc )

<bihash> ( -- biassoc )

Converting existing assocs to biassocs:
>biassoc ( assoc -- biassoc )