Esempio n. 1
0
 public function map(callable $callback)
 {
     return new Self(Fp\map($callback, $this->values()));
 }
Esempio n. 2
0
 public function testMapWithCollection()
 {
     $this->assertEquals([1, 4, 9], Fp\map(square_makker(), new Fp\Collection\Collection([1, 2, 3]))->values());
 }
Esempio n. 3
0
 public function testTransducing()
 {
     $transduced = $this->collection->transduce(Fp\compose(Fp\map(square_makker()), Fp\filter(is_even_makker())), Fp\appending())->values();
     $this->assertEquals([4, 16], $transduced);
 }