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