/** * @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; } }
public function testIsEmpty() { $c = new Collection(); self::assertTrue($c->isEmpty()); }