?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 )


assocan assoc
keyan object

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


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