search-alist ( key alist -- pair/f i/f ) (original) (raw)
Inputs
key | an object |
---|---|
alist | an array of key/value pairs |
Outputs
pair/f | a key/value pair |
---|---|
i/f | an integer |
Word description
Iterates over alist and stops when the key is matched or the end of the alist has been reached. If there is no match, both outputs are f.
Notes
This word is used to implement at* and set-at on sequences, and should not be called directly.
Examples
USING: prettyprint assocs.private kernel ; 3 { { 1 2 } { 3 4 } } search-alist [ . ] bi@
{ 3 4 } 1
USING: prettyprint assocs.private kernel ; 6 { { 1 2 } { 3 4 } } search-alist [ . ] bi@
f f
Definition