Fried quotation philosophy
Factor handbook » The language » Fried quotations

Prev:Examples of fried quotations
Next:fry ( object -- quot )


Fried quotations generalize quotation-building words such as curry and compose. They can clean up code with lots of currying and composition, particularly when quotations are nested:
'[ [ _ key? ] all? ] filter [ [ key? ] curry all? ] curry filter

There is a mapping from fried quotations to lexical closures as defined in the locals vocabulary. Namely, a fried quotation is equivalent to a [| | ] form where each local binding is only used once, and bindings are used in the same order in which they are defined. The following two lines are equivalent:
'[ 3 _ + 4 _ / ] [| a b | 3 a + 4 b / ]