Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
22
Task/Priority-queue/FunL/priority-queue.funl
Normal file
22
Task/Priority-queue/FunL/priority-queue.funl
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
import util.ordering
|
||||
native scala.collection.mutable.PriorityQueue
|
||||
|
||||
data Task( priority, description )
|
||||
|
||||
def comparator( Task(a, _), Task(b, _) )
|
||||
| a > b = -1
|
||||
| a < b = 1
|
||||
| otherwise = 0
|
||||
|
||||
q = PriorityQueue( ordering(comparator) )
|
||||
|
||||
q.enqueue(
|
||||
Task(3, 'Clear drains'),
|
||||
Task(4, 'Feed cat'),
|
||||
Task(5, 'Make tea'),
|
||||
Task(1, 'Solve RC tasks'),
|
||||
Task(2, 'Tax return')
|
||||
)
|
||||
|
||||
while not q.isEmpty()
|
||||
println( q.dequeue() )
|
||||
Loading…
Add table
Add a link
Reference in a new issue