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

Prev:of ( assoc key -- value/f )
Next:value-at ( value assoc -- key/f )


Vocabulary
assocs

Inputs
assocan assoc
keyan object


Outputs
value/keythe value associated to the key, or the key if the key is not present in the assoc
?a boolean indicating if the key was present


Word description
Looks up the value associated with a key. If the key was not present, an error can be thrown without extra stack shuffling. This word handles assocs that store f.

See also
at, at*, key?, ?at, of

Definition


: ?of ( assoc key -- value/key ? ) swap ?at ; inline