public function testMappingAndFirst()
 {
     $transformed = Fp\transduce(Fp\compose(Fp\mapping(square_makker()), Fp\first(function ($x) {
         return $x > 6;
     })), Fp\single_result(), range(1, 6));
     $this->assertEquals(9, $transformed);
 }
Ejemplo n.º 2
0
 public function testItReturnASingleValueForEarlyTerminaisonTransducer()
 {
     $transducer = Fp\first(equal_three_makker());
     $reduced = Fp\transduce($transducer, Fp\single_result(), range(1, 6));
     $this->assertEquals(3, $reduced);
 }
Ejemplo n.º 3
0
 public function testItApplyTheCallableOnEachItem()
 {
     $transducer = Fp\first(equal_three_makker());
     $reduced = Fp\transduce($transducer, Fp\single_result(), range(1, 6));
     $this->assertEquals(3, $reduced);
 }