Next: , Previous: , Up: lists fold   [Index]


23.8.3 Folding with traditional style

The functions fold and fold* are similar to fold-left* and fold-right* but knil is always the last argument of the calls to kons.

Function: fold kons knil circ1 circ2 ...
Syntax: fold/stx kons knil circ1 circ2 ...

Left fold the function kons over the elements of the list arguments. Accept lists of different length and stop at the end of the shortest list. At least one of the list arguments must be finite. The syntax may be a little faster than the function when multiple circ arguments are involved.

Function: fold* kons knil circ1 circ2 ...
Syntax: fold*/stx kons knil circ1 circ2 ...

Right fold the function kons over the elements of the list arguments. Accept lists of different length and stop at the end of the shortest list. At least one of the list arguments must be finite. The syntax may be a little faster than the function when multiple circ arguments are involved.