Priority queue: Difference between revisions

m
m (→‎{{header|C}}: {{out}})
Line 153:
 
=={{header|Axiom}}==
Axiom already has a heap domain for ordered sets. We define a domain for ordered key-entry pairs and then define a priority queue using the heap domain over the pairs:
We define a domain for ordered key-entry pairs and then define a priority queue using the heap domain over the pairs:
<lang Axiom>)abbrev Domain ORDKE OrderedKeyEntry
OrderedKeyEntry(Key:OrderedSet,Entry:SetCategory): Exports == Implementation where
Line 186 ⟶ 187:
pq(1):="Solve RC tasks";
pq(2):="Tax return";
[extract!(pq) for i in 1..#pq]</lang>Output:<lang Axiom>
{{out}}
<pre>
[[5,"Make tea"], [4,"Feed cat"], [3,"Clear drains"], [2,"Tax return"],
[1,"Solve RC tasks"]]
Type: List(OrderedKeyEntry(Integer,String))</langpre>
 
 
=={{header|C}}==
Anonymous user