src/QCheck/FP.php
public static function partition($n, $coll)
    {
        $coll = self::iterator($coll);
        for ($coll->rewind(); $coll->valid();) {
            $partition = [];
            for ($i = 0; $i < $n && $coll->valid(); ++$i, $coll->next()) {
                $partition[] = $coll->current();
            }
            yield $partition;
        }
    }
public static function partition($n, $coll)
    {
        $coll = self::iterator($coll);
        for ($coll->rewind(); $coll->valid();) {
            $partition = [];
            for ($i = 0; $i < $n && $coll->valid(); ++$i, $coll->next()) {
                $partition[] = $coll->current();
            }
            yield $partition;
        }
    }
public static function partition ( $ n , $ coll ) { $ coll = self :: iterator ( $ coll ) ; for ( $ coll -> rewind ( ) ; $ coll -> valid ( ) ; ) { $ partition = [ ] ; for ( $ i = 0 ; $ i < $ n && $ coll -> valid ( ) ; ++ $ i , $ coll -> next ( ) ) { $ partition [ ] = $ coll -> current ( ) ; } yield $ partition ; } }
Return the given collection partitioned in n sized segments
in a lazy fashion.

@param int $n
@param $coll
@return \Generator
Return the given collection partitioned in n sized segments in a lazy fashion .