Exemple #1
0
/**
 * @param Collection $xs
 * @param integer $result
 * @param \Closure $f
 * @return integer
 */
function iterateCollection(Collection $xs, $result, $f)
{
    if (!$xs->isEmpty()) {
        return iterateCollection($xs->tail(), $f($xs->head()) + $result, $f);
    } else {
        return $result;
    }
}
Exemple #2
0
 public function testGetIterator()
 {
     $c = new Collection();
     self::assertInstanceOf(\Iterator::class, $c->getIterator());
 }