This commit is contained in:
2025-07-15 01:28:53 -04:00
parent a1241905ea
commit cd27bdf2e0
6 changed files with 64 additions and 9 deletions

13
tests/luau/reduce.luau Normal file
View File

@ -0,0 +1,13 @@
--!strict
local Array = require("../../luau/src")
local numbers = Array.new({1, 2, 3, 4})
print(numbers:tostring(), "\nlength=", numbers:len())
local sum = numbers:reduce(function(accumulator: number, currentValue: number)
return accumulator - currentValue
end)
print("sum=", sum)