[erlang-questions] Managing priority heaps.
Anthony Shipman
als@REDACTED
Sun Nov 4 08:29:03 CET 2007
On Sunday 04 November 2007 14:24, Anders Nygren wrote:
>
> I dont think there is anything ready made for this, but You can look at two
> modules in stdlib that can be useful.
> - queue, obviously queue functions, instead of element(A, Z) ++ [Fst] which
> gets expensive if the lists are long.
> - ets, with table type ordered set. to make a priority queue in ets
> store your entries as {{Prio,now()}, Data}, when You read you get the first
> inserted, using suitable matching/selection functions.
The gb_trees module has functions like take_largest, take_smallest which look
like they can be used for heaps.
--
Anthony Shipman Mamas don't let your babies
als@REDACTED grow up to be outsourced.
More information about the erlang-questions
mailing list