let getpos heap pos =
       get heap (IntPairHash.find heap.hash pos)