local A=script.Parent local Z=A.Parent local T=require(Z.t)local j=T.tuple(T.table,T.callback)local function o(A,Z,T)assert(j(A,Z))local o=#A local W=T local g=o if W==nil then W=A[o]g=o-1 end for T=g,1,-1 do W=Z(W,A[T],T)end return W end return o
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