assoc-find ( ... assoc quot: ( ... key value -- ... ? ) -- ... key value ? ) (original) (raw)

Vocabulary
assocs

Inputs

assoc an assoc
quot a quotation with stack effect ( ... key value -- ... ? )

Outputs

key the successful key, or f
value the successful value, or f
? a boolean

Word description
Applies a predicate quotation to each entry in the assoc. Returns the key and value that the quotation succeeds on, or f for both if the quotation fails. It also returns a boolean describing whether there was anything found; this can be used to distinguish between a key and a value equal to f, or nothing being found.

Definition