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


Vocabulary
assocs

Inputs
keyan object
assocan assoc


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?, of, ?of

Definition


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