case>quot ( default assoc -- quot )
Factor handbook » The language » Combinators » Quotation construction utilities

Prev:cond>quot ( assoc -- quot )
Next:alist>quot ( default assoc -- quot )


Vocabulary
combinators

Inputs
defaulta quotation
assoca sequence of pairs of quotations


Outputs
quota quotation


Word description
Creates a quotation that when called, has the same effect as applying case to assoc.

This word uses three strategies:
If the assoc only has a few keys, a linear search is generated.
If the assoc has a large number of keys which form a contiguous range of integers, a direct dispatch is generated using the dispatch word together with a bounds check.
Otherwise, an open-coded hashtable dispatch is generated.


Definition