Goto Chapter: Top 1 2 3 4 Ind
 [Top of Book]  [Contents]   [Previous Chapter]   [Next Chapter] 

3 Serially evaluate recursive iterators
 3.1 Serially evaluate recursive iterators

3 Serially evaluate recursive iterators

3.1 Serially evaluate recursive iterators

3.1-1 SeriallyEvaluateRecursiveIterator
‣ SeriallyEvaluateRecursiveIterator( iter )( function )

Returns: an iterator of leaves.

Serially evaluate the recursive iterator iter. The produced leaves are then returned in a usual iterator.

This example enumerates all full binary trees with 9 leaves. The number is the sixth Catalan number.

gap> ReadPackage( "ParallelizedIterators", "examples/CatalanIterator.g" );
true
gap> n := 9;
9
gap> riter := IteratorCatalanTree( [[ 1 .. n ]], [[ 1 ]] );
<iterator>
gap> liter := SeriallyEvaluateRecursiveIterator( riter );
<iterator>
gap> i := 0;
0
gap> while not IsDoneIterator( liter ) do NextIterator( liter ); i:=i+1; od;
gap> i;
1430
 [Top of Book]  [Contents]   [Previous Chapter]   [Next Chapter] 
Goto Chapter: Top 1 2 3 4 Ind

generated by GAPDoc2HTML