Hello people,

i am learning nim right know and for my first project i choose to implement a 
brainf*ck interpreter, in doing so i implemented a memory dump feature, that 
was quit easy but to do so i need to know the last index of the Table i am 
using for the memory, in order to only dump from zero to the last index memory

So i read the documentation of the tables module, but there's nothing to get 
the last key, the only wait to get the last index with Tables.keys iterator, 
the dump procedure look like this
    
    
    proc dump(mem: Table[Natural, char]) : string =
        var last : Natural
        
        for key in mem.keys:
            if key > last: last = key
        
        for index in countup(0, last, 16):
            ...
    
    Run

As you can it is not the most optimal way to do it, do someone here know a 
better way at getting the last index ?

Reply via email to