func (v *GenericVectorType) Set(i int, item GenericType) *GenericVectorType {
	if i < 0 || uint(i) >= v.len {
		panic("Index out of bounds")
	}
	if uint(i) >= v.tailOffset() {
		newTail := make([]GenericType, len(v.tail))
		copy(newTail, v.tail)
		newTail[i&shiftBitMask] = item
		return &GenericVectorType{root: v.root, tail: newTail, len: v.len, shift: v.shift}
	}
	return &GenericVectorType{root: v.doAssoc(v.shift, v.root, uint(i), item), tail: v.tail, len: v.len, shift: v.shift}
}
Set returns a new vector with the element at position i set to item.
package generic_types
import (
	"encoding/binary"
	"fmt"
	"hash/crc32"
	"math"
	"unsafe"
)
const shiftSize = 5
const nodeSize = 32
const shiftBitMask = 0x1F
type commonNode interface{}
var emptyCommonNode commonNode = []commonNode{}
func uintMin(a, b uint) uint {
	if a < b {
		return a
	}
	return b
}
func newPath(shift uint, node commonNode) commonNode {
	if shift == 0 {
		return node
	}
	return newPath(shift-shiftSize, commonNode([]commonNode{node}))
}
func assertSliceOk(start, stop, len int) {
	if start < 0 {
		panic(fmt.Sprintf("Invalid slice index %d (index must be non-negative)", start))
	}
	if start > stop {
		panic(fmt.Sprintf("Invalid slice index: %d > %d", start, stop))
	}
	if stop > len {
		panic(fmt.Sprintf("Slice bounds out of range, start=%d, stop=%d, len=%d", start, stop, len))
	}
}
const upperMapLoadFactor float64 = 8.0
const lowerMapLoadFactor float64 = 2.0
const initialMapLoadFactor float64 = (upperMapLoadFactor + lowerMapLoadFactor) / 2
func hash(x []byte) uint32 {
	return crc32.ChecksumIEEE(x)
}
func nilinterhash(p unsafe.Pointer, h uintptr) uintptr
func interfaceHash(x interface{}) uint32 {
	return uint32(nilinterhash(unsafe.Pointer(&x), 0))
}
func byteHash(x byte) uint32 {
	return hash([]byte{x})
}
func uint8Hash(x uint8) uint32 {
	return byteHash(byte(x))
}
func int8Hash(x int8) uint32 {
	return uint8Hash(uint8(x))
}
func uint16Hash(x uint16) uint32 {
	bX := make([]byte, 2)
	binary.LittleEndian.PutUint16(bX, x)
	return hash(bX)
}
func int16Hash(x int16) uint32 {
	return uint16Hash(uint16(x))
}
func uint32Hash(x uint32) uint32 {
	bX := make([]byte, 4)
	binary.LittleEndian.PutUint32(bX, x)
	return hash(bX)
}
func int32Hash(x int32) uint32 {
	return uint32Hash(uint32(x))
}
func uint64Hash(x uint64) uint32 {
	bX := make([]byte, 8)
	binary.LittleEndian.PutUint64(bX, x)
	return hash(bX)
}
func int64Hash(x int64) uint32 {
	return uint64Hash(uint64(x))
}
func intHash(x int) uint32 {
	return int64Hash(int64(x))
}
func uintHash(x uint) uint32 {
	return uint64Hash(uint64(x))
}
func boolHash(x bool) uint32 {
	if x {
		return 1
	}
	return 0
}
func runeHash(x rune) uint32 {
	return int32Hash(int32(x))
}
func stringHash(x string) uint32 {
	return hash([]byte(x))
}
func float64Hash(x float64) uint32 {
	return uint64Hash(math.Float64bits(x))
}
func float32Hash(x float32) uint32 {
	return uint32Hash(math.Float32bits(x))
}
type GenericVectorType struct {
	tail  []GenericType
	root  commonNode
	len   uint
	shift uint
}
var emptyGenericVectorTypeTail = make([]GenericType, 0)
var emptyGenericVectorType *GenericVectorType = &GenericVectorType{root: emptyCommonNode, shift: shiftSize, tail: emptyGenericVectorTypeTail}
func NewGenericVectorType(items ...GenericType) *GenericVectorType {
	return emptyGenericVectorType.Append(items...)
}
func (v *GenericVectorType) Get(i int) GenericType {
	if i < 0 || uint(i) >= v.len {
		panic("Index out of bounds")
	}
	return v.sliceFor(uint(i))[i&shiftBitMask]
}
func (v *GenericVectorType) sliceFor(i uint) []GenericType {
	if i >= v.tailOffset() {
		return v.tail
	}
	node := v.root
	for level := v.shift; level > 0; level -= shiftSize {
		node = node.([]commonNode)[(i>>level)&shiftBitMask]
	}
	return node.([]GenericType)
}
func (v *GenericVectorType) tailOffset() uint {
	if v.len < nodeSize {
		return 0
	}
	return ((v.len - 1) >> shiftSize) << shiftSize
}