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);
 }
 public function testItReturnASingleValueForEarlyTerminaisonTransducer()
 {
     $transducer = Fp\first(equal_three_makker());
     $reduced = Fp\transduce($transducer, Fp\single_result(), range(1, 6));
     $this->assertEquals(3, $reduced);
 }
Exemple #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);
 }