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

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


Vocabulary
combinators

Inputs
assoca sequence of pairs of quotations


Outputs
quota quotation


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

The generated quotation is more efficient than the naive implementation of cond, though, since it expands into a series of conditionals, and no iteration through assoc has to be performed.

Notes
This word is used behind the scenes to compile cond forms efficiently; it can also be called directly, which is useful for meta-programming.

Definition