Vocabulary

sequences

Inputs

Outputs

Word description

Combines successive elements of the sequence and their indices binary operations, and outputs the final result. On the first iteration, the three inputs to the quotation are identity, the first element of the sequence, and its index, 0. On successive iterations, the first input is the result of the previous iteration, the second input is the corresponding element of the sequence, and the third is its index.

Examples

Definition

sequences

Inputs

seq | a sequence |

identity | an object |

quot | a quotation with stack effect ( ... prev elt index -- ... next ) |

Outputs

result | an object |

Word description

Combines successive elements of the sequence and their indices binary operations, and outputs the final result. On the first iteration, the three inputs to the quotation are identity, the first element of the sequence, and its index, 0. On successive iterations, the first input is the result of the previous iteration, the second input is the corresponding element of the sequence, and the third is its index.

Examples

USING: sequences prettyprint math ;
{ 10 50 90 } 0 [ + + ] reduce-index .

153

153

Definition