Talk:Priority queue: Difference between revisions

 
Line 1:
== Lua version broken? ==
 
I think the Lua version is broken. Well the default list of things works just fine and makes the correct output, if you change the list of priorities to:
<lang lua>tasks = {
{3, 'Clear drains'},
{334455, 'Feed cat'},
{441234, 'Make tea'},
{23, 'Solve RC tasks'},
{2, 'Tax return'}
}</lang>
You get what i think is completely, wrong output.
<lang>Putting: 3 - Clear drains
Putting: 334455 - Feed cat
Putting: 441234 - Make tea
Putting: 23 - Solve RC tasks
Putting: 2 - Tax return
Popped: 441234 - Make tea
Popped: 2 - Tax return
Popped: 334455 - Feed cat
Popped: 23 - Solve RC tasks
Popped: 3 - Clear drains</lang>
I think this happens because Lua guarantees no order to associative tables (key value pairs), the example is just lucky enough that that hashes are lining up or something.
 
== Refinement ==