protected static function __takeWhile(callable $predicate, array $list) : array
    {
        $result = [];

        foreach ($list as $item) {
            if ($predicate($item)) {
                $result[] = $item;
            } else {
                break;
            }
        }

        return $result;
    }