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

Prev:case>quot ( default assoc -- quot )


defaulta quotation
assoca sequence of quotation pairs

quota new quotation

Word description
Constructs a quotation which calls the first quotation in each pair of assoc until one of them outputs a true value, and then calls the second quotation in the corresponding pair. Quotations are called in reverse order, and if no quotation outputs a true value then default is called.

This word is used to implement compile-time behavior for cond, and it is also used by the generic word system. Note that unlike cond, the constructed quotation performs the tests starting from the end and not the beginning.