anchor.diff:                                   , data = Data }) ->    
       { N, maps:to_list(Data) }.
       
  -
  -% Here's a simple description of Misra-Gries' Frequent algorithm. Demaine (2002) and
  -% others have optimized the algorithm, but this gives you the gist.
  -
  -% Specify the threshold fraction, 1 / k; any item that occurs more than n / k times will
  -% be found. Create an an empty map (like a red-black tree); the keys will be search terms,
  -% and the values will be a counter for that term.
  -
  -% Look at each item in the stream.
  -% If the term exists in the map, increment the associated counter.
  -% Otherwise, if the map less than k - 1 entries, add the term to the map with a counter of one.
  -% However, if the map has k - 1 entries already, decrement the counter in every entry.
  -% If any counter reaches zero during this process, remove it from the map.
  -% Note that you can process an infinite amount of data with a fixed amount of storage
  -% (just the fixed-size map). The amount of storage required depends only on the threshold of
  -% interest, and the size of the stream does not matter.
  -
  
positive.code:     
                             
  minmax_push( X
             , #stream_minmax{ min = Min
                             , max = Max })
          when X < Min  ->
      #stream_minmax{ min = X, max = Max };
          
          
  minmax_push( X
             , #stream_minmax{ min = Min
                             , max = Max })
          when X > Max  ->
      #stream_minmax{ min = Min, max = X };
          
  
negative.code: -export([ sample_new/1, sample_push/2, sample_values/1
          , sample_test/0]).
  -export([ minmax_new/0, minmax_push/2, minmax_values/1]).
  -export([ fold_new/2, fold_push/2, fold_values/1]).
  -export([ frequent_new/1, frequent_push/2, frequent_values/1]).
          
  
  