Handbook
Glossary
?value-at ( value assoc -- key/value ? )
Factor handbook
»
The language
»
Collections
»
Associative mapping operations
»
Lookup and querying of assocs
Prev:
value-at ( value assoc -- key/f )
Next:
assoc-empty? ( assoc -- ? )
Vocabulary
assocs
Inputs
value
an
object
assoc
an
assoc
Outputs
key/value
the key associated to the value or the value if the value is not present in the assoc
?
a
boolean
indicating if the value was present
Word description
Looks up the key associated with a value. If the value was not present, an error can be thrown without extra stack shuffling. This word handles assocs that store
f
.
Definition
USING:
kernel
;
IN:
assocs
:
?value-at
( value assoc -- key/value ? )
2dup
value-at*
[
2nip
t
]
[
2drop
f
]
if
;
inline