<commit_before><?php

namespace Verraes\Lambdalicious;

use ArrayObject;
use BadMethodCallException;

final class FluentCollection extends ArrayObject
{
    public function __construct(array $input)
    {
        parent::__construct($input, $flags = 0, $iterator_class = 'ArrayIterator');
    }

    public function __get($name)
    {
        switch ($name) {
            case '§':
                return array_values($this->getArrayCopy());
                break;
            default:
                throw new BadMethodCallException;
        }
    }

    public function map(callable $f)
    {
        return new FluentCollection(array_map($f, $this->§));
    }

    public function filter(callable $f)
    {
        return new FluentCollection(array_filter($this->§, $f));
    }

    public function fold(callable $f, $initial = 0)
    {
        return array_reduce($this->§, $f, $initial);
    }
}<commit_msg>incorrect initial value in fold()<commit_after><?php

namespace Verraes\Lambdalicious;

use ArrayObject;
use BadMethodCallException;

/**
 * @property $§ Returns the Collection as an array
 */
final class FluentCollection extends ArrayObject
{
    public function __construct(array $input)
    {
        parent::__construct($input, $flags = 0, $iterator_class = 'ArrayIterator');
    }

    public function __get($name)
    {
        switch ($name) {
            case '§':
                return array_values($this->getArrayCopy());
                break;
            default:
                throw new BadMethodCallException;
        }
    }

    /**
     * @param callable $f
     * @return FluentCollection
     */
    public function map(callable $f)
    {
        return new FluentCollection(array_map($f, $this->§));
    }

    /**
     * @param callable $f
     * @return FluentCollection
     */
    public function filter(callable $f)
    {
        return new FluentCollection(array_filter($this->§, $f));
    }

    /**
     * @param callable $f
     * @param mixed $initial
     * @return mixed
     */
    public function fold(callable $f, $initial = null)
    {
        return array_reduce($this->§, $f, $initial);
    }
}
{'fraction_non_alphanumeric': 0.1191806331471136, 'fraction_numerical': 0.0013966480446927375, 'mean_word_length': 2.2709284627092847, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7383261', 'n_tokens_mistral': 636, 'n_tokens_neox': 619, 'n_words': 152}