コード例 #1
0
 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);
 }
コード例 #2
0
ファイル: MappingTest.php プロジェクト: aRn0D/php-functional
 public function testItApplyTheCallableOnEachItem()
 {
     $transducer = Fp\mapping(square_makker());
     $squared = Fp\transduce($transducer, Fp\appending(), range(1, 2));
     $this->assertEquals([1, 4], $squared);
 }