Module PriorityQueue { a= ((3, "Clear drains"), (4 ,"Feed cat"), ( 5 , "Make tea")) a=cons(a, ((1 ,"Solve RC tasks"), ( 2 , "Tax return"))) b=stack comp=lambda (a, b) -> array(a, 0)1 then shiftback m } } n=each(a) while n InsertPq b, array(n), &comp end while n1=each(b) while n1 m=stackitem(n1) print array(m, 0), array$(m, 1) end while \\ Peek topitem (without popping) print Array$(stackitem(b), 1) \\ Pop item Stack b { Read old } print Array$(old, 1) def Peek$(a)=Array$(stackitem(a), 1) Function Pop$(a) { stack a { =Array$(stackitem(), 1) drop } } print Peek$(b) print Pop$(b) def IsEmpty(a)=len(a)=0 while not IsEmpty(b) print pop$(b) end while } PriorityQueue