Closed CMCDragonkai closed 5 years ago
The reason why using a list as a stack is a bad idea to remember the deallocated numbers is because the list is not ordered naturally, you have to put the number into stack from lowest to highest. The stack thus needs to be a min-heap not a simple list. At any case, if we are going to go for a stack to implement deallocation, we might as well go the full way and implement the resource counter tree directly into Haskell by porting the JS implementation.
@ramwan Hey close this if this is now done.
@ramwan Hey close this if this is now done.
I think the state counter code is too complicated right now. We can assume that we don't want to reuse numbers yet. We can figure that out later.
To have the same API as the js-resource-counter (https://www.npmjs.com/package/resource-counter), you should be able to make do with something like this: