A simple Priority Queue in OCaml
A clever way to implement a priority queue using the Set module that makes use of the min_elt
/min_elt_opt
functions and internal ordering on the priority.
I’m thinking of re-implementing the A* implementation I did for Advent of Code to lean on this. It’s already sets, so it shouldn’t affect the speed, but it’ll likely make it significantly less awkward, especially as far as finding the current element goes.
Here is where the example priority queue implementation mentioned can be found. More recent versions of the documentation don’t appear to have it anymore.