<commit_before><?php

namespace Vector\Lib;

use Vector\Core\FunctionCapsule;

class ArrayList extends FunctionCapsule
{
    // [a] -> a
    protected static function head($list)
    {
        return $list[0];
    }

    // [a] -> [a]
    protected static function tail($list)
    {
        return array_slice($list, 1, count($list));
    }

    // [a] -> [a]
    protected static function init($list)
    {
        return array_slice($list, 0, count($list) - 1);
    }

    // [a] -> a
    protected static function last($list)
    {
        return $list[count($list) - 1];
    }

    // [a] -> Int
    protected static function length($list)
    {
        return count($list);
    }

    // Int -> [a] -> a
    protected static function index($i, $list)
    {
        return $list[$i];
    }

    // Int -> [a] -> a -> [a]
    protected static function set($key, $arr, $val)
    {
        $arrCopy   = $arr;
        $arr[$key] = $val;

        return $arr;
    }
}<commit_msg>Removed dead code in ArrayList::set - arrays are passed by value anyway, so it's unneeded to begin with<commit_after><?php

namespace Vector\Lib;

use Vector\Core\FunctionCapsule;

class ArrayList extends FunctionCapsule
{
    // [a] -> a
    protected static function head($list)
    {
        return $list[0];
    }

    // [a] -> [a]
    protected static function tail($list)
    {
        return array_slice($list, 1, count($list));
    }

    // [a] -> [a]
    protected static function init($list)
    {
        return array_slice($list, 0, count($list) - 1);
    }

    // [a] -> a
    protected static function last($list)
    {
        return $list[count($list) - 1];
    }

    // [a] -> Int
    protected static function length($list)
    {
        return count($list);
    }

    // Int -> [a] -> a
    protected static function index($i, $list)
    {
        return $list[$i];
    }

    // Int -> [a] -> a -> [a]
    protected static function set($key, $arr, $val)
    {
        $arr[$key] = $val;
        return $arr;
    }
}
{'fraction_non_alphanumeric': 0.15906838453914768, 'fraction_numerical': 0.004955401387512388, 'mean_word_length': 1.93033381712627, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 23, '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': '4771486', 'n_tokens_mistral': 675, 'n_tokens_neox': 652, 'n_words': 176}