local f=script.Parent local u=f.Parent local T=require(u.t)local J=T.tuple(T.table,T.callback)local function i(f,u,T)assert(J(f,u))local i=#f local W=T local F=i if W==nil then W=f[i]F=i-1 end for T=F,1,-1 do W=u(W,f[T],T)end return W end return i
local List = script.Parent

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

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

local function reduceRight(list, reducer, initialReduction)
	assert(validate(list, reducer))

	local len = #list
	local reduction = initialReduction
	local start = len

	if reduction == nil then
		reduction = list[len]
		start = len - 1
	end

	for i = start, 1, -1 do
		reduction = reducer(reduction, list[i], i)
	end

	return reduction
end

return reduceRight