diff options
| author | Matthew Sackman <matthew@lshift.net> | 2010-04-12 11:28:16 +0100 |
|---|---|---|
| committer | Matthew Sackman <matthew@lshift.net> | 2010-04-12 11:28:16 +0100 |
| commit | e71d2d1311d53ea099e83e765c7db64f7407eb9b (patch) | |
| tree | c5bdf4d742a348117069b2890079033c7b3b730d /src | |
| parent | a4196b06525dffd8fb53362d4a54dc55c17dbb7b (diff) | |
| download | rabbitmq-server-git-e71d2d1311d53ea099e83e765c7db64f7407eb9b.tar.gz | |
Apparently, abuse of empty queues is unsightly. Also, minor improvement to documentation
Diffstat (limited to 'src')
| -rw-r--r-- | src/bpqueue.erl | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/bpqueue.erl b/src/bpqueue.erl index 3ba0414465..4e9cdb3153 100644 --- a/src/bpqueue.erl +++ b/src/bpqueue.erl @@ -32,9 +32,10 @@ -module(bpqueue). %% Block-prefixed queue. This implements a queue of queues, but -%% supporting the normal queue interface. Each block has a prefix and -%% it is guaranteed that no two consecutive blocks have the same -%% prefix. len/1 returns the flattened length of the queue and is O(1) +%% supporting the normal queue interface. Each inner queue has a +%% prefix, which does not need to be unique, and it is guaranteed that +%% no two consecutive blocks have the same prefix. len/1 returns the +%% flattened length of the queue and is O(1). -export([new/0, is_empty/1, len/1, in/3, in_r/3, out/1, out_r/1, join/2, foldl/3, foldr/3, from_list/1, to_list/1, map_fold_filter_l/4, @@ -87,7 +88,7 @@ len({N, _Q}) -> N. in(Prefix, Value, {0, Q}) -> - {1, queue:in({Prefix, queue:in(Value, Q)}, Q)}; + {1, queue:in({Prefix, queue:from_list([Value])}, Q)}; in(Prefix, Value, BPQ) -> in1({fun queue:in/2, fun queue:out_r/1}, Prefix, Value, BPQ). |
