hamt.js
function arraySpliceIn(mutate, at, v, arr) {
    var len = arr.length;
    if (mutate) {
        var _i = len;
        while (_i >= at) {
            arr[_i--] = arr[_i];
        }arr[at] = v;
        return arr;
    }
    var i = 0,
        g = 0;
    var out = new Array(len + 1);
    while (i < at) {
        out[g++] = arr[i++];
    }out[at] = v;
    while (i < len) {
        out[++g] = arr[i++];
    }return out;
}
function arraySpliceIn(mutate, at, v, arr) {
    var len = arr.length;
    if (mutate) {
        var _i = len;
        while (_i >= at) {
            arr[_i--] = arr[_i];
        }arr[at] = v;
        return arr;
    }
    var i = 0,
        g = 0;
    var out = new Array(len + 1);
    while (i < at) {
        out[g++] = arr[i++];
    }out[at] = v;
    while (i < len) {
        out[++g] = arr[i++];
    }return out;
}
function arraySpliceIn ( mutate , at , v , arr ) { var len = arr . length ; if ( mutate ) { var _i = len ; while ( _i >= at ) { arr [ _i -- ] = arr [ _i ] ; } arr [ at ] = v ; return arr ; } var i = 0 , g = 0 ; var out = new Array ( len + 1 ) ; while ( i < at ) { out [ g ++ ] = arr [ i ++ ] ; } out [ at ] = v ; while ( i < len ) { out [ ++ g ] = arr [ i ++ ] ; } return out ; }
Insert a value into an array.

@param mutate Should the input array be mutated?
@param at Index to insert at.
@param v Value to insert,
@param arr Array.
Insert a value into an array .