local function p(p,d,T)local J=type(p)assert(J=="\116\097\098\108\101","\101\120\112\101\099\116\101\100 \097 \116\097\098\108\101 \102\111\114 \102\105\114\115\116 \097\114\103\117\109\101\110\116\044 \103\111\116 "..J)local C=type(d)assert(C=="\102\117\110\099\116\105\111\110","\101\120\112\101\099\116\101\100 \097 \102\117\110\099\116\105\111\110 \102\111\114 \115\101\099\111\110\100 \097\114\103\117\109\101\110\116\044 \103\111\116 "..C)local O=#p local s=T or p[O]local r=T==nil and O-1 or O for T=r,1,-1 do s=d(s,p[T],T)end return s end return p

local function reduceRight(list, reducer, initialReduction)
	local listType = type(list)
	assert(listType == "table", "expected a table for first argument, got " .. listType)
	
	local reducerType = type(reducer)
	assert(reducerType == "function", "expected a function for second argument, got " .. reducerType)
	
	local len = #list
	local reduction = initialReduction or list[len]
	local start = initialReduction == nil and len - 1 or len

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

	return reduction
end

return reduceRight