示例#1
0
 public function testFoldLeftRight()
 {
     $map = new Map(array('a' => 'b', 'c' => 'd', 'e' => 'f'));
     $rsLeft = $map->foldLeft('', function ($a, $b) {
         return $a . $b;
     });
     $rsRight = $map->foldRight('', function ($a, $b) {
         return $a . $b;
     });
     $this->assertEquals('bdf', $rsLeft);
     $this->assertEquals('bdf', $rsRight);
 }