Slide 29
Slide 29 text
class PiorityQueueMonoid[T] (max : Int)
(implicit order : Ordering[T] )
extends Monoid[Priorityqueue[T] ]
Let’s take a look :
PQ1 : 55, 45, 21, 3
PQ2: 100, 80, 40, 3
top-4 (PQ1 U PQ2 ): 100, 80, 55, 45
Priority Queue :
Can be empty
Two Priority Queues can be “added” in any order
Associative + Commutative
Makes Scalding go fast,
by doing sorting,
filtering and extracting
in one single “map”
step.