Exemplo n.º 1
0
 function testPartition()
 {
     $this->assertEquals([[0], [1], [2]], FP::realize(FP::partition(1, FP::range(0, 3))));
     $this->assertEquals([[0, 1], [2, 3], [4, 5], [6]], FP::realize(FP::partition(2, FP::range(0, 7))));
     $this->assertEquals([[0, 1, 2], [3, 4, 5], [6, 7]], FP::realize(FP::partition(3, FP::range(0, 8))));
 }
Exemplo n.º 2
0
 public static function sizes($maxSize)
 {
     return FP::cycle(function () use($maxSize) {
         return FP::range(0, $maxSize);
     });
 }