Well I think a pop proc would look like this instead:
    
    
    proc pop*[A, B](t: var Table[A, B]): (A, B) =
      if len(t) == 0:
         raise newException(KeyError, "pop(): dictionary is empty")
      for h in countdown(high(t.data), 0):
         if isFilled(t.data[h].hcode):
           result (t.data[h].key, t.data[h].val)
           t.del(result[0])
    
    
    Run

What do you think?

Reply via email to