<commit_before><?php
declare(strict_types = 1);

namespace Fixtures\Innmind\Filesystem;

use Innmind\Filesystem\Name as Model;
use Innmind\BlackBox\Set;

final class Name
{
    /**
     * @return Set<Model>
     */
    public static function any(): Set
    {
        return Set\Decorate::immutable(
            static fn(string $name): Model => new Model($name),
            Set\Composite::immutable(
                static fn(string $first, array $chrs): string => $first.\implode('', $chrs),
                Set\Decorate::immutable(
                    static fn(int $chr): string => \chr($chr),
                    Set\Elements::of(
                        33,
                        ...range(1, 8),
                        ...range(14, 31),
                        ...range(35, 38),
                        ...range(40, 46),
                        ...range(48, 122),
                        ...range(126, 127),
                    ),
                ),
                Set\Sequence::of(
                    Set\Decorate::immutable(
                        static fn(int $chr): string => \chr($chr),
                        Set\Elements::of(
                            ...range(1, 33),
                            ...range(35, 38),
                            ...range(40, 46),
                            ...range(48, 127),
                        ),
                    ),
                    Set\Integers::between(0, 254),
                ),
            )->filter(static fn(string $name): bool => $name !== '.' && $name !== '..'),
        );
    }
}<commit_msg>use sets instead of loading all values in memory<commit_after><?php
declare(strict_types = 1);

namespace Fixtures\Innmind\Filesystem;

use Innmind\Filesystem\Name as Model;
use Innmind\BlackBox\Set;

final class Name
{
    /**
     * @return Set<Model>
     */
    public static function any(): Set
    {
        return Set\Decorate::immutable(
            static fn(string $name): Model => new Model($name),
            Set\Composite::immutable(
                static fn(string $first, array $chrs): string => $first.\implode('', $chrs),
                Set\Decorate::immutable(
                    static fn(int $chr): string => \chr($chr),
                    new Set\Either(
                        Set\Elements::of(33, 126, 127),
                        Set\Integers::between(1, 8),
                        Set\Integers::between(14, 31),
                        Set\Integers::between(35, 38),
                        Set\Integers::between(40, 46),
                        Set\Integers::between(48, 122),
                        Set\Integers::between(48, 122),
                    ),
                ),
                Set\Sequence::of(
                    Set\Decorate::immutable(
                        static fn(int $chr): string => \chr($chr),
                        new Set\Either(
                            Set\Integers::between(1, 33),
                            Set\Integers::between(35, 38),
                            Set\Integers::between(40, 46),
                            Set\Integers::between(48, 127),
                        ),
                    ),
                    Set\Integers::between(0, 254),
                ),
            )->filter(static fn(string $name): bool => $name !== '.' && $name !== '..'),
        );
    }
}
{'fraction_non_alphanumeric': 0.13972355769230768, 'fraction_numerical': 0.030348557692307692, 'mean_word_length': 1.1096324461343472, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 17, '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': '2800758', 'n_tokens_mistral': 974, 'n_tokens_neox': 841, 'n_words': 176}