anchor.diff:  %%% @reference <a href="http://arxiv.org/pdf/cs/0505038v1.pdf">
   %%% 	Efficient Management of Short-Lived Data</a>
   %%% @todo Expire during operations?
  +%%% @end
   %%%---------------------------------------------------------------------
   %%%
   -module(ephemeral_trees).
  
positive.code: find({_, _, _, _, Right}, Key) ->
  	find(Right, Key).
  
  -spec insert(Tree :: treap(), Key :: term(), Item :: term()) -> treap().
  %% @equiv insert(Tree, Key, erlang:system_time(), Item)
  insert(Tree, Key, Item) ->
  	insert(Tree, Key, erlang:system_time(), Item).
  
  -spec insert(Tree :: treap(), Key :: term(),
  		Time :: erlang:system_time(), Item :: term()) -> treap().
  %% @doc Inserts `Key' with value `Item' into `Tree'.
  %% 	Returns a new `Tree'.
  insert({Left, Key, _, _, Right} = _Tree, Key, Time, Item) ->
  	{Left, Key, Time, Item, Right};
  insert({Left, K, T, I, Right}, Key, Time, Item) when Key < K ->
  	rebalance({insert(Left, Key, Time, Item), K, T, I, Right});
  
negative.code: -export([new/0, find/2, insert/3, insert/4, remove/2, expire/2]).
  
  -opaque treap() :: undefined | {Left :: treap(), Key :: term(),
  		Time :: pos_integer(), Item :: term(), Right :: treap()}.
  -export_type([treap/0]).
  %% @type treap(). The treap data structure is a combination of a tree
  %% 	and a heap. This `treap()' is a binary search tree with respect
  %% 	to a `Key' and a heap with respect to an integer `Time'. The
  %% 	tree is rebalanced when an `Item' is inserted or removed so that
  %%		the oldest entries are leef nodes and the newest are clustered
  %% 	around the root of the tree. The main benefit is that expiring
  %% 	all entries older than a selected `Time' may be done very
  %% 	efficiently by pruning branches.
  
  -spec new() -> Tree
  	when
  		Tree :: treap().
  %% @doc Returns a new empty `Tree'.
  new() ->
  	undefined.
  
  -spec find(Tree, Key) -> Item
  	when
  		Tree :: treap(),
  		Key :: term(),
  		Item :: term().
  %% @doc Retrieves the value stored with `Key' in `Tree'.
  %% 	Assumes the key exists, crashes otherwise.
  find({_, Key, _, Item, _} = _Tree, Key) ->
  	Item;
  find({Left, K, _, _, _}, Key) when Key < K ->
  