anchor.diff:      pack_double(O);
   pack(nil) ->
       pack_nil();
  -pack(Bool) when is_atom(Bool) ->
  -    pack_bool(Bool);
  +pack(true) ->
  +    pack_true();
  +pack(false) ->
  +    pack_false();
   pack(Bin) when is_binary(Bin) ->
       pack_raw(Bin);
   pack(List)  when is_list(List) ->
  
positive.code: % ===== internal APIs ===== %
  
  % positive fixnum
  pack_uint_(N) when is_integer( N ) , N < 128 ->
      << 2#0:1, N:7 >>;
  % uint 8
  pack_uint_( N ) when is_integer( N ) andalso N < 256 ->
      << 16#CC:8, N:8 >>;
  
  % uint 16
  pack_uint_( N ) when is_integer( N ) andalso N < 65536 ->
      << 16#CD:8, N:16/big-unsigned-integer-unit:1 >>;
  
  % uint 32
  pack_uint_( N ) when is_integer( N ) andalso N < 16#FFFFFFFF->
      << 16#CE:8, N:32/big-unsigned-integer-unit:1 >>;
  
  % uint 64
  pack_uint_( N ) when is_integer( N )->
      << 16#CF:8, N:64/big-unsigned-integer-unit:1 >>.
  
  % negative fixnum
  pack_int_( N ) when is_integer( N ) , N >= -32->
      << 2#111:3, N:5 >>;
  % int 8
  pack_int_( N ) when is_integer( N ) , N >= -256 ->
      << 16#D0:8, N:8 >>;
  % int 16
  pack_int_( N ) when is_integer( N ), N >= -65536 ->
      << 16#D1:8, N:16/big-signed-integer-unit:1 >>;
  % int 32
  pack_int_( N ) when is_integer( N ), N >= -16#FFFFFFFF ->
      << 16#D2:8, N:32/big-signed-integer-unit:1 >>;
  % int 64
  pack_int_( N ) when is_integer( N )->
      << 16#D3:8, N:64/big-signed-integer-unit:1 >>.
  
  % nil
  pack_nil()->    << 16#C0:8 >>.
  % pack_true / pack_false
  pack_bool(true)->    << 16#C3:8 >>;
  pack_bool(false)->   << 16#C2:8 >>.
  
  % float : erlang's float is always IEEE 754 64bit format.
  %pack_float(F) when is_float(F)->
  %    << 16#CA:8, F:32/big-float-unit:1 >>.
  %    pack_double(F).
  % double
  pack_double(F) when is_float(F)->
      << 16#CB:8, F:64/big-float-unit:1 >>.
  
  % raw bytes
  pack_raw(Bin) when is_binary(Bin)->
      case byte_size(Bin) of
  	Len when Len < 6->
  	    << 2#101:3, Len:5, Bin/binary >>;
  
negative.code:     end.
  
  % list / tuple
  pack_array(L) ->
      case length(L) of
   	Len when Len < 16 ->
   	    << 2#1001:4, Len:4/integer-unit:1, (pack_array_(L, <<>>))/binary >>;
  	Len when Len < 16#10000 -> % 65536
  	    << 16#DC:8, Len:16/big-unsigned-integer-unit:1, (pack_array_(L, <<>>))/binary >>;
  	Len ->
  	    << 16#DD:8, Len:32/big-unsigned-integer-unit:1, (pack_array_(L, <<>>))/binary >>
      end.
  pack_array_([], Acc) -> Acc;
  pack_array_([Head|Tail], Acc) ->
      pack_array_(Tail, <<Acc/binary,  (pack(Head))/binary>>).
  
  % FIXME! this should be tail-recursive and without lists:reverse/1
  unpack_array_(Remain, 0, RetList) -> {lists:reverse(RetList), Remain};
  unpack_array_(Bin, RestLen, RetList) ->
      case unpack(Bin) of
  	{more, Len} -> {more, Len+RestLen-1};
  	{Term, Rest}-> unpack_array_(Rest, RestLen-1, [Term|RetList])
  