public function inGroups(callable $classifier, Collector $base = null): array
    {
        $collector = (null === $base) ? Collector::forList() : $base;
        return $this->with(
                function() { return []; },
                function(&$groups, $element) use($classifier, $collector)
                {
                    $key = $classifier($element);
                    if (!isset($groups[$key])) {
                        $groups[$key] = $collector->fork();
                    }

                    $groups[$key]->accumulate($element, $key);
                },
                function($groups)
                {
                    foreach ($groups as $key => $group) {
                        $groups[$key] = $group->finish();
                    }

                    return $groups;
                }
        );
    }