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

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


Inputs and outputs
keyan object
assocan assoc
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?, of, ?of


: ?at ( key assoc -- value/key ? )
2dup at* [ 2nip t ] [ 2drop f ] if ; inline