예제 #1
0
 public function testIt()
 {
     $constFalse = f\complement(function () {
         return true;
     });
     $constTrue = f\complement(function () {
         return false;
     });
     $invert = f\complement(function ($bool) {
         return $bool;
     });
     $nand = f\complement(f\operator('&&'));
     $this->assertEquals(false, $constFalse());
     $this->assertEquals(true, $constTrue());
     $this->assertEquals(false, $invert(true));
     $this->assertEquals(true, $invert(false));
     $this->assertEquals(false, $nand(true, true));
     $this->assertEquals(true, $nand(true, false));
 }
예제 #2
0
파일: remove.php 프로젝트: pablodip/felpado
/**
 * f\remove($fn, $coll)
 *
 * Returns a new collection with the values that applied to fn are false.
 *
 * f\remove(function ($value) { return $value % 2 == 0; }, range(1, 6));
 * => array(1, 3, 5)
 */
function remove($fn, $coll)
{
    return f\filter(f\complement($fn), $coll);
}