Handbook Glossary
factorcode.org
new-assoc ( capacity exemplar -- newassoc )
Factor handbook » The language » Collections » Associative mapping operations » Associative mapping protocol

Prev:value-at* ( value assoc -- key/f ? )
Next:assoc-like ( assoc exemplar -- newassoc )


Vocabulary
assocs

Inputs
capacitya non-negative integer
exemplaran assoc


Outputs
newassocan assoc


Generic word contract
Creates a new assoc from an exemplar which can hold capacity entries before growing.

Definition
IN: assocs

GENERIC: new-assoc ( capacity exemplar -- newassoc )


Methods
USING: assocs hashtables kernel ;

M: assoc new-assoc drop <hashtable> ; inline


USING: assocs kernel vectors xml.data ;

M: attrs new-assoc drop <vector> <attrs> ;


USING: assocs kernel trees.avl ;

M: avl new-assoc 2drop <avl> ;


USING: assocs biassocs hashtables kernel ;

M: biassoc new-assoc
drop [ <hashtable> ] [ <hashtable> ] bi biassoc boa ;


USING: assocs hashtables kernel ;

M: f new-assoc drop <hashtable> ; inline


USING: assocs hashtables.identity kernel ;

M: identity-hashtable new-assoc drop <identity-hashtable> ;


USING: assocs hashtables.numbers kernel ;

M: number-hashtable new-assoc drop <number-hashtable> ;


USING: assocs hashtables.sequences kernel ;

M: sequence-hashtable new-assoc drop <sequence-hashtable> ;


USING: assocs kernel sequences vectors ;

M: sequence new-assoc drop <vector> ; inline


USING: assocs kernel trees.splay ;

M: splay new-assoc 2drop <splay> ;


USING: accessors assocs kernel xml.data ;

M: tag new-assoc [ attrs>> ] call \ new-assoc execute ;


USING: assocs kernel trees ;

M: tree new-assoc 2drop <tree> ;