assoc-stack ( key seq -- value )
Factor handbook » The language » Collections » Associative mapping operations » Lookup and querying of assocs

Prev:values ( assoc -- values )


Vocabulary
assocs

Inputs
keya key
seqa sequence of assocs


Outputs
valuea value or f


Word description
Searches for the key in successive elements of the sequence, starting from the end. If an assoc containing the key is found, the associated value is output. If no assoc contains the key, outputs f.

Notes
This word is used to implement abstractions such as nested scopes; if the sequence is a stack represented by a vector, then the most recently pushed assoc -- the innermost scope -- will be searched first.

Definition