anchor.diff:  
   maybe_truncate(NewOffsets, SQ = #shared_q{queue = Q}) ->
       MinClientSeq = min_val_tree:min(NewOffsets),
  -    {Garbage,Q1} = sequence_monoid:split_by_seq(fun(Seq) -> Seq >= MinClientSeq end,Q),
  -    {sequence_monoid:measure(Garbage),
  +    {Garbage,Q1} = monoid_sequence:split_by_seq(fun(Seq) -> Seq >= MinClientSeq end,Q),
  +    {monoid_sequence:measure(Garbage),
        SQ#shared_q{queue = Q1,client_seqs = NewOffsets}}.
   
   min_seq(#shared_q{client_seqs = Offsets}) -> min_val_tree:min(Offsets).
  
positive.code: max_seq(#shared_q{cur_seq = Seq}) -> Seq.
  
  read(FromSeq,ToSeq, #shared_q{queue = Q}) ->
      {_,Rest}     = sequence_monoid:split_by_seq(fun(Seq) -> Seq >= FromSeq end, Q),
      {Interval,_} = sequence_monoid:split_by_seq(fun(Seq) -> Seq =< ToSeq end, Rest),
      sequence_monoid:to_list(Interval).
  
  
  
negative.code:     queue       :: any()             %% the actual queue
  }).
  
  new(Seq,Comp) ->
      #shared_q{client_seqs = min_val_tree:new(Comp),
                queue = monoid_sequence:empty(),
                cur_seq = Seq}.
  
  pushr(El,SQ = #shared_q{cur_seq = Seq,queue = Q}) ->
      Seq1 = Seq+1,
      SQ#shared_q{cur_seq = Seq1,queue = monoid_sequence:pushr_w_seq(Seq1,El,Q)}.
  
  forward(ClientId,ToSeq,SQ = #shared_q{client_seqs = Offsets}) ->
      Offsets1 = min_val_tree:store(ClientId,ToSeq,Offsets),
  