cleave ( x seq -- )

Factor handbook » The language » Combinators » Dataflow combinators » Cleave combinators

Factor handbook » The language » Combinators » Dataflow combinators » Cleave combinators

Prev: | 3tri ( x y z p q r -- ) |

Next: | 2cleave ( x y seq -- ) |

Vocabulary

combinators

Inputs

Outputs

None

Word description

Applies each quotation to the object in turn.

Examples

The bi combinator takes one value and two quotations; the tri combinator takes one value and three quotations. The cleave combinator takes one value and any number of quotations, and is essentially equivalent to a chain of keep forms:

See also

bi, tri

Definition

combinators

Inputs

x | an object |

seq | a sequence of quotations with stack effect ( x -- ... ) |

Outputs

None

Word description

Applies each quotation to the object in turn.

Examples

The bi combinator takes one value and two quotations; the tri combinator takes one value and three quotations. The cleave combinator takes one value and any number of quotations, and is essentially equivalent to a chain of keep forms:

! Equivalent
{ [ p ] [ q ] [ r ] [ s ] } cleave
[ p ] keep [ q ] keep [ r ] keep s

See also

bi, tri

Definition