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=T local W=1 if i==nil then i=f[1]W=2 end for T=W,#f,1 do i=u(i,f[T],T)end return i 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 reduce(list, reducer, initialReduction)
	assert(validate(list, reducer))

	local reduction = initialReduction
	local start = 1

	if reduction == nil then
		reduction = list[1]
		start = 2
	end

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

	return reduction
end

return reduce