Skip to content

I can't run the test from Readme #8

@foul11

Description

@foul11

On all configurations, the test failed.

Tested on:

  • win10 x64
  • and lua:
    • Lua 5.1.5
    • LuaJIT 2.1.1695653777
    • Lua 5.3.6 / due to the increased stack size, the number in the test was not 40000, but 900000
local memoize = require('memoize')

local function tri(x)
  if x == 0 then return 0 end
  return x+tri(x-1)
end

-- print(tri(40000)) -- here we get a stackoverflow, as expected

local memoized_tri = mem(tri)

for i=0, 40000 do
	if i % 1000 == 0 then print(i) end
	memoized_tri(i) -- here we also get a stackoverflow, but it was expected that there wouldn’t be one
end

print(memoized_tri(40000)) -- we'll never get here

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions