keys ( assoc -- keys )
Factor documentation > Factor handbook > The language > Collections > Associative mapping operations > Lookup and querying of assocs
Prev:assoc-empty? ( assoc -- ? )
Next:values ( assoc -- values )


Vocabulary
assocs

Inputs and outputs
assocan assoc
keysan array of keys


Word description
Outputs an array of all keys in the assoc.

See also
values

Definition
IN: assocs

GENERIC: keys ( assoc -- keys )


Methods
USING: assocs kernel ;

M: assoc keys [ drop ] { } assoc>map ;


USING: accessors assocs biassocs ;

M: biassoc keys from>> keys ;


USING: accessors arrays assocs sequences ;

M: enum keys seq>> length iota >array ; inline


USING: assocs hashtables hashtables.private kernel ;

M: hashtable keys [ drop ] collect-pairs ;


USING: accessors assocs mirrors sequences ;

M: mirror keys object-slots [ name>> ] map ;


USING: assocs persistent.hashtables sequences ;

M: persistent-hash keys >alist [ first ] map ;


USING: accessors assocs hashtables.wrapped sequences ;

M: wrapped-hashtable keys
underlying>> keys [ underlying>> ] map! ;