local I=script.Parent local t=I.Parent local c=require(t.t)local Z=c.tuple(c.table,c.integer)local function s(I,t,c)assert(Z(I,t))local s=#I if t<0 then t=s+t end assert(t>0 and t<=s+1,string.format("\105\110\100\101\120 \037\100 \111\117\116 \111\102 \098\111\117\110\100\115 \111\102 \108\105\115\116 \111\102 \108\101\110\103\116\104 \037\100",t,s))local J={}local r=1 for Z=1,s,1 do if Z==t then J[r]=c else J[r]=I[Z]end r+=1 end return J end return s
local List = script.Parent

local Llama = List.Parent
local t = require(Llama.t)

local validate = t.tuple(t.table, t.integer)

local function set(list, index, value)
	assert(validate(list, index))
	
	local len = #list

	if index < 0 then
		index = len + index
	end

	assert(index > 0 and index <= len + 1, string.format("index %d out of bounds of list of length %d", index, len))

	local new = {}
	local indexNew = 1

	for i = 1, len do
		if i == index then
			new[indexNew] = value
		else
			new[indexNew] = list[i]
		end

		indexNew += 1
	end

	return new
end

return set