Exemple #1
0
 public function testMapFilter()
 {
     $numbers = [1, 2, 3, 4];
     $inc = function ($x) {
         return $x + 1;
     };
     $isEven = function ($x) {
         return $x % 2 === 0;
     };
     $xf = t::comp(t::map($inc), t::filter($isEven));
     $result = t::into([], $xf, $numbers);
     $this->assertEquals([2, 4], $result);
 }