Yep, that's definitely not well documented. "ord" is an Ordering object which is used mostly in sorting, albeit often behind the scenes. There are a couple of basic orderings (Forward, Reverse), as well as a few that allow for different types of comparison or sorts (e.g., permutations, lexigraphical ordering).
Some of these used to be directly exposed, but as far as I can tell, the only way to get to them now is through Base.Order. Here's how to create a max priority queue: import Base.Collections: PriorityQueue, dequeue! import Base.Order.Reverse pq = PriorityQueue(Int64,Float64,Reverse) pq[1] = 1.0 pq[2] = 234.0 pq[3] = 2.5 foo = dequeue!(pq) println(foo) # yields "2" println(pq) # yields Base.Collections.PriorityQueue(3=>2.5,1=>1.0) Would you be up to submitting a pull request updating the documentation <https://github.com/JuliaLang/julia/blob/master/CONTRIBUTING.md#improving-documentation>? Or, if not, can you open an issue <https://github.com/JuliaLang/julia/issues>? It's also probably reasonable to change the constructor to PriorityQueues to be similar to sort function calls, although with some recent changes to functions (#13412 <https://github.com/JuliaLang/julia/pull/13412>), the best way to specify the ordering might change. Cheers, Kevin On Tue, Jan 5, 2016 at 3:08 PM, Craig Schmidt <[email protected]> wrote: > Sorry for a basic question. I want to have a maximum priority queue, but > I can’t figure out what to pass as the third “ord” parameter. The > documentation seems silent on this issue. That is, I want the dequeue call > to return 2 rather than 1. Is there a way I could use the system to tell > me what it is expecting for the ord parameter? While I’m at it, what is > the most Julian way to import things? > > import Collections: PriorityQueue, dequeue! > > pq = PriorityQueue(Int64,Float64) > pq[1] = 1.0 > pq[2] = 234.0 > pq[3] = 2.5 > foo = dequeue!(pq) > println(foo) > println(pq) > > Thanks, > Craig > >
