public function fold(callable $func, $acc) : self
    {
        $list = $this->list;

        foreach ($list as $val) {
            $acc = $func($acc, $val);
        }

        return new static($acc);
    }
public function fold(callable $func, $acc) : self
    {
        $list = $this->list;

        foreach ($list as $val) {
            $acc = $func($acc, $val);
        }

        return new static($acc);
    }
public function fold ( callable $ func , $ acc ) : self { $ list = $ this -> list ; foreach ( $ list as $ val ) { $ acc = $ func ( $ acc , $ val ) ; } return new static ( $ acc ) ; }
fold method.

@method fold

@param callable $func
@param mixed    $acc

@return object Collection
fold method .