local I=script.Parent local t=I.Parent local c=require(t.t)local Z=c.tuple(c.table,c.callback)local function s(I,t,c)assert(Z(I,t))local s=#I local J=c local r=s if J==nil then J=I[s]r=s-1 end for c=r,1,-1 do J=t(J,I[c],c)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.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